Install latest version of docker on CentOS7

1.Add repository for docker community edition

#yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

2. If you want to install development version of docker community edition, make the repository enable for docker-ce-edge.

#yum-config-manager --enable docker-ce-edge

3. Install docker community edition

#yum install docker-ce

4. Start docker and enable auto start

#systemctl start docker
#systemctl enable docker

5. Check if docker is running

# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b04784fba78d: Pull complete
Digest: sha256:f3b3b28a45160805bb16542c9531888519430e9e6d6ffc09d72261b0d26ff74f
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

Advertisements

Install Apache and PHP 7.1 on CentOS 7.1

1.Install Apache

#yum -y install httpd
#systemctl start httpd
#systemctl enable httpd

#firewall-cmd --permanent --zone=public --add-service=http 
#firewall-cmd --permanent --zone=public --add-service=https
#firewall-cmd --reload

2. Install PHP 7.1

If older version of PHP already installed, remove them.
# yum remove php-*

Get pubic key for remi repository
#sudo rpm --import https://rpms.remirepo.net/RPM-GPG-KEY-remi

Install Remi repository
# yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

Install PHP 7.1.x
# yum install --enablerepo=remi-php71 php php-devel php-mbstring php-intl php-pdo php-gd php-ldap php-mysqlnd php-pear php-xml php-gd php-mcrypt 

Reload Apache
#systemctl reload httpd

Check PHP version
#php -v
PHP 7.1.6 (cli) (built: Jun  7 2017 12:15:54) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies


3. Edit php.ini

#vi /etc/php.ini
date.timezone = "Asia/Tokyo"

mbstring.language = Japanese
mbstring.internal_encoding = UTF-8
mbstring.http_input = UTF-8
mbstring.http_output = pass
mbstring.encoding_translation = On
mbstring.detect_order = auto
mbstring.substitute_charset = none

;
memory_limit = 1024M

;
post_max_size = 1024M

;
upload_max_filesize = 1024M

4. Enable changes

#systemctl reload httpd

Install Apache & PHP 5.6.x on CentOS 7.1

1.Install Apache

#yum -y install httpd
#systemctl start httpd
#systemctl enable httpd

#firewall-cmd --permanent --zone=public --add-service=http 
#firewall-cmd --permanent --zone=public --add-service=https
#firewall-cmd --reload

2. Install PHP 5.6.x

If older version of PHP already installed, remove them.
# yum remove php-*

Install Remi repository
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

Install PHP 5.6.x
# yum install --enablerepo=remi,remi-php56 php php-devel php-mbstring php-pdo php-gd php-ldap php-mysqlnd php-pear php-xml php-gd php-mcrypt 

Reload Apache
#systemctl reload httpd

Check PHP version
#php -v
PHP 5.6.30 (cli) (built: Jan 19 2017 07:57:06) 
Copyright (c) 1997-2016 The PHP Group


3. Edit php.ini

#vi /etc/php.ini
date.timezone = "Asia/Tokyo"

mbstring.language = Japanese
mbstring.internal_encoding = UTF-8
mbstring.http_input = UTF-8
mbstring.http_output = pass
mbstring.encoding_translation = On
mbstring.detect_order = auto
mbstring.substitute_charset = none

;
memory_limit = 1024M

;
post_max_size = 1024M

;
upload_max_filesize = 1024M

4. Enable changes

#systemctl reload httpd

Let’s chat & surrogator on CentOS 7.1

1.Install Apache

#yum -y install httpd
#systemctl start httpd
#systemctl enable httpd

#firewall-cmd --permanent --zone=public --add-service=http 
#firewall-cmd --permanent --zone=public --add-service=https
#firewall-cmd --reload

2.Install NodeJS

#curl -sL https://rpm.nodesource.com/setup_7.x | bash -
#yum install -y nodejs

3. Install mongoDB

# vi /etc/yum.repos.d/mongodb-org-3.4.repo 

[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc

# yum install -y mongodb-org
# systemctl start mongod.service
# systemctl enable mongod.service

4. Install Let’s chat

# yum install git -y
# cd /opt
# git clone https://github.com/sdelements/lets-chat.git
# cd /opt/lets-chat
# npm install
# npm install lets-chat-ldap

5. Edit settings.yml

# cd /opt/lets-chat
# cp settings.yml.sample settings.yml
# vi settings.yml

rooms: #Enable to set password for chat room
   private: true

i18n: #Make menu Japanese
  locale: ja

giphy: #Disable giphy
  enable: false


#Remove the files section and prevent to upload any files
files:

6. Edit “app.js”

# vi /opt/lets-chat/app.js

  helmet = require('helmet'),
    http = require('http'),
    nunjucks = require('nunjucks'),
    mongoose = require('mongoose'),
    connectMongo = require('connect-mongo/es5'),
    all = require('require-tree'),
    psjon = require('./package.json'),
    settings = require('./app/config'),
    auth = require('./app/auth/index'),
    core = require('./app/core/index');

//add the below at this position.
mongoose.Promise = global.Promise;

var MongoStore = connectMongo(express.session),
    httpEnabled = settings.http && settings.http.e

7.Run Let’s chat

# npm start

Confirm no error occurs as follows




You can terminate Let's chat by short cut key of ctrl+c

If you encounter some errors, check settings.yml.

8. Reverse proxy settings for Apache

#vi /etc/httpd/conf.d/letschat.conf

ProxyRequests off
ProxyPass /chat/ http://127.0.0.1:5000/
ProxyPass /chat http://127.0.0.1:5000/
ProxyPassReverse /chat/ http://127.0.0.1:5000/
Redirect "/login" "/chat/login

#systemctl stop httpd
#systemctl start httpd

* You can access to Let's chat via URL of http://$hostname/chat/
* You CAN NOT enable reverse proxy under SELINUX enforcing setting

9. Customization for search function for the message (Make double bytes character enable)

# vi /opt/lets-chat/app/core/messages.js

if (options.query) {
find = find.find({$text: {$search: options.query}}); //remove
}


if (options.query) {
//add
var r = new RegExp(options.query, "i")
find = find.find({"text": {$regex:r}});
}

10. Authentication via Active Directory

1. Edit auth: section as follows
2. Do indent and add space exactly same as follows
3. If you log on via account without email address entry, Let's chat will be hanged up.
------------------------------------------
auth:
  providers: [ldap]

  ldap:
    connect_settings:
      url: ldap://ad.local.yasu.jp:389
    server_certs: []
    bind_options:
      bindDN: CN=Administrator,CN=Users,DC=local,DC=yasu,DC=jp
      bindCredentials: Administratorのパスワード
    search:
      base: "DC=local,DC=yasu,DC=jp"
      opts:
        scope: sub
        filter: (sAMAccountName={{username}})
        attributes: []
    field_mappings:
      uid: sAMAccountName
      firstName: givenName
      lastName: sn
      displayName: displayName
      email: mail
-----------------------------------------

*After editing settings.yml, run Let's chat via command of "npm start". If you encounter some errors, check settings.yml. Any unappropriate indents cause errors.

11. Install forever

# cd /opt/lets-chat
# npm install forever -g

Confirm running and supping let's chat service by the following command.

Start
#forever start app.js

Stop
#forever stop app.js



surrogator as Avatar service
Let’s chat is using https://www.gravatar.com/ as Avatar service at default setting. However we could not use the site due to firewall settings, we installed surrogator as Avatar service into the same machine running Let’s chat.

12. Check Apache’s settings for surrogator

Enable .htaccess under Document root
# vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
    #Change from None to All
    #AllowOverride None
    AllowOverride All

Enable rewrite Module
# vi /etc/httpd/conf.modules.d/00-base.conf

If the following line is commented out, uncomment.
LoadModule rewrite_module modules/mod_rewrite.so

If you changed Apache settings, reload Apache to enable settings
#systemctl reload httpd

12. Install surrogator

# cd /var/www/html  *Move to Document root
# git clone https://github.com/cweiske/surrogator
# cp /var/www/html/surrogator/data/surrogator.config.php.dist /var/www/html/surrogator/data/surrogator.config.php
# vi /var/www/html/surrogator/data/surrogator.config.php

*Increase the Avatar size for Let's Chat. 
$sizes   = array(16, 20, 30, 32, 48, 50, 64, 80, 96, 100, 128, 256, 512);
//$sizes   = array(16, 32, 48, 64, 80, 96, 128, 256, 512);

# mv /var/www/html/surrogator/www/avatar.php /var/www/html
# mv /var/www/html/surrogator/www/.htaccess /var/www/html

# vi /var/www/html/avatar.php

*Change file path.
//$cfgFile = __DIR__ . '/../data/surrogator.config.php';
$cfgFile = "./surrogator/data/surrogator.config.php";

*Change directory's permission if you need.
# chown apache:apache /var/www/html/surrogator/raw/

*Check if surrogator is running correctly. 
*Access from your client via web browser to the link below. 
http://(your hostname or IP)/avatar/
*If you recognize the following message on your browser, surrogator is running correctly.
Hash has to be 32 or 64 characters long

13. Set the default Avatar
This Avatar is displayed when user don’t have their Avatar

Upload default.png or default.jpg of Avatar file to /var/www/html/surrogator/raw/

*Execute the command below
# php /var/www/html/surrogator/surrogator.php

14. Replace Avatar URL in the Let’s Chat source file.

Replace all the srting of "www.gravatar.com" within the source files under /opt/lets-chat to "Your hostname" 

I found the string of "www.gravatar.com" within the following files. 
------------------------------
templates/includes/js/browser-item-user.html
templates/includes/js/user.html
templates/includes/js/message.html
app/core/avatar-cache.js
media/js/login.js
templates/chat.html
media/js/views/room.js
media/js/views/window.js
------------------------------

You can find the files including the string of "www.gravatar.com" from the link below by searching the word of "www.gravatar.com"
https://github.com/sdelements/lets-chat


https://www.vultr.com/docs/how-to-deploy-a-lets-chat-server-on-centos-7
http://hayachi617.blogspot.jp/2015_06_01_archive.html
https://github.com/sdelements/lets-chat/issues/411
https://github.com/sdelements/lets-chat-ldap

Install TortoiseGit

Install Git for Windows

Download Git for Windows from the link below.
https://git-for-windows.github.io/

Run a downloaded program.

Click Next
ws000007

Click Next
ws000008


Recommend unpicking "Windows Explorer Integration" for only using TortoiseGit
ws000010

Click Next
ws000011

Click Next
ws000012

Pick the middle when you collaborate between Windows and Unix.
ws000013

Click Next
ws000014

Click Install
ws000015

Install TortoiseGit

Download appropriate version of TortoiseGit for your Windows and 
language pack if you use it other than English.
https://tortoisegit.org/download/

Run the program

Click Next
ws000017

Click Next
ws000018

Click Next
ws000019

Click Next
ws000020

Click Install
ws000021

Click Finish
ws000022

Run language pack and click Next
ws000023

Click Finish
ws000024

Create an account on Bitbucket

  1. Go to Bitbucket

  2. Click “Get strated for free”

    WS000007

  3. Enter an email address and click “Continue”

    WS000008

  4. Enter name ,password and click “Continue”

    WS000009

  5. You will receive an email to verify your email address.

    WS000010

  6. Click “Verify my email address”

    WS000011

  7. Enter a user name for your Bitbucket account and click “Continue”

    WS000012

  8. You can change display language

    Click “View profile”
    WS000002

    Select language and click “Update profile”
    WS000001

Install latest version of git on CentOS6.8

# sudo yum remove git
# sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker
#cd /opt/src
# wget  https://www.kernel.org/pub/software/scm/git/git-2.10.0.tar.gz
# tar -zvxf git-2.10.0.tar.gz
# cd git-2.10.0

# ./configure –prefix=/usr/local
# make
# make  install
# git –version
git version 2.10.0

If you encountered the following error.
#git –version
-bash: /usr/bin/git: No such file or directory

#hash -r