Skip to content

Instantly share code, notes, and snippets.

@chayn1k
Forked from hofmannsven/README.md
Last active September 18, 2015 11:04
Show Gist options
  • Save chayn1k/9ffe2e33e31de3565d21 to your computer and use it in GitHub Desktop.
Save chayn1k/9ffe2e33e31de3565d21 to your computer and use it in GitHub Desktop.
Notes on working with CentOS 6 on the Command Line Interface.

Working with CentOS

Working with PHP CLI: https://gist.github.com/hofmannsven/9976152

Setup

User setup (for .bash_profile, .gitconfig,...): cd ~

Install git: yum install git

Install nano: yum install nano

Status & Restart

Check status: service --status-all

Restart Network: sudo service network restart

Restart Apache: apachectl restart

Restart HTTPD: service httpd restart

Install WP-CLI

See http://wp-cli.org/

Install mcrypt:

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum update

yum install -y php-mcrypt

service httpd restart

Install SOAP:

Install soap into Centos: yum install php-soap

Check if the soap package exist: yum search php-soap

Locate the package (search from root folder): find -name soap.so

Add to php.ini file: extension='/usr/lib/php/modules/soap.so'

Install Composer

See http://codybonney.com/installing-composer-globally-on-centos-6-4/

Install Node.js

See https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#enterprise-linux-and-fedora

Setup Custom Virtual Hosts Configuration

  • Config files are located at: /var/www/vhosts/<domain>/conf
  • Create custom vhosts files vhost.conf and vhost_ssl.conf (plain config, no <VirtualHost> container!)
  • Update included config files: /usr/local/psa/admin/bin/httpdmng --reconfigure-all
  • Restart Apache: /etc/init.d/httpd stop » /etc/init.d/httpd start or /etc/init.d/httpd restart

HTTPD Config

  • Location: /etc/httpd/conf/httpd.conf

Setup SSL

  • Insert both CA certificates via Plesk admin panel like this within CA Certificate field:
-----BEGIN CERTIFICATE-----
Root CA Certificate
RSA SHA-2 (under SHA-1 Root) SSL Certificates
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
SSL intermediate Certificate
RSA SHA-1 SSL Certificates
-----END CERTIFICATE-----
  • Then update included config files: /usr/local/psa/admin/bin/httpdmng --reconfigure-all

Fix FREAK OpenSSL vulnerability

Update to PHP v5.6

See http://www.shayanderson.com/linux/centos-5-or-centos-6-upgrade-php-to-php-54-or-php-55.htm

  • Check installed packages: yum list installed | grep php
  • Remove all the packages: yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-imap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64 php-soap.x86_64 php-xml.x86_64
  • Add new packages (el6 for CentOS 6): rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
  • Checkout the new packages: yum list available | grep php
  • Install new packages: yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-imap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-soap.x86_64 php56w-xml.x86_64
  • Download PSA: wget http://autoinstall.plesk.com/PSA_9.5.4/dist-rpm-CentOS-5-x86_64/contrib/psa-php5-configurator-1.5.3-cos5.build95101209.08.noarch.rpm
  • Then: rpm -ivh psa-php5-configurator-1.5.3-cos5.build95101209.08.noarch.rpm
  • Restart web server: service httpd restart

Add Subdomain to VHOSTS

  • Config files are located at: /var/www/vhosts/<domain>/conf
  • Bootstrap-Vhosts is located at: /usr/local/psa/admin/conf/vhosts_bootstrap.conf

Postfix Mail

  • Log files are located at: /usr/local/psa/var/log/maillog
  • Config files are located at: /etc/postfix/main.cf
  • Reload after upate: /etc/init.d/postfix reload

Update Git

See http://tecadmin.net/install-git-2-0-on-centos-rhel-fedora/

  • yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
  • yum install gcc perl-ExtUtils-MakeMaker
  • Remove Git: yum remove git
  • Go to src: cd /usr/src
  • Download latest version: wget https://www.kernel.org/pub/software/scm/git/git-2.4.3.tar.gz
  • tar xzf git-2.4.3.tar.gz
  • cd git-2.4.3
  • make prefix=/usr/local/git all
  • make prefix=/usr/local/git install
  • make prefix=/usr/local/git install
  • source /etc/bashrc
  • Test: git --version

Run in background

Run task make in background (even when the stty is cut off): nohup make &

Manage users

List all users: getent passwd (see /etc/passwd)

Change user password: sudo passwd username (will prompt for new password)

More information: http://askubuntu.com/a/410274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment