Skip to content

Instantly share code, notes, and snippets.

@johnyaucc
Last active January 3, 2016 13:39
Show Gist options
  • Select an option

  • Save johnyaucc/8471340 to your computer and use it in GitHub Desktop.

Select an option

Save johnyaucc/8471340 to your computer and use it in GitHub Desktop.
# The MySQL server
[mysqld]
max_allowed_packet = 128M
#
# Install Apache 2.2.26, PHP 5.4.23 and MySQL 5.5.33
#
## RHEL/CentOS 5 64-Bit ##
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
## Other Repos
#rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
#rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-11.ius.el5.noarch.rpm
rpm -Uvh http://centos.alt.ru/repository/centos/5/x86_64/centalt-release-5-3.noarch.rpm
# system update
yum update
## Apache
yum --enablerepo=CentALT install httpd
## MySQL
rpm -ivh MySQL-server-5.5.33-1.rhel5.x86_64.rpm
rpm -ivh MySQL-client-5.5.33-1.rhel5.x86_64.rpm
rpm -ivh MySQL-devel-5.5.33-1.rhel5.x86_64.rpm
rpm -ivh MySQL-shared-5.5.33-1.rhel5.x86_64.rpm
rpm -ivh MySQL-shared-compat-5.5.32-1.rhel5.x86_64.rpm
#yum --enablerepo=ius install mysql55
# create /etc/my.cnf (see etc-my.cnf below)
yum --enablerepo=CentALT install php54 php54-devel php54-mysql php54-pdo php54-mbstring
# install libtool-ltdl (for php54-mcrypt)
rpm -ivh http://mirror.centos.org/centos/5/os/x86_64/CentOS/libtool-ltdl-1.5.22-7.el5_4.x86_64.rpm
yum --enablerepo=CentALT install php54-gd php54-xml php54-xmlrpc php54-mcrypt
yum --enablerepo=CentALT install -y php-pear
pear install Log
# ???
yum --enablerepo=CentALT install -y pcre-devel
# Configure httpd.conf
User beansbox
Group beansbox
# create vhosts and set vhosts.conf (see below vhosts.conf)
mkdir /var/www/vhosts
vi /etc/httpd/conf.d/vhosts.conf
# --------------
# start services
/sbin/service httpd start
/sbin/service mysql start
# start on reboot
/sbin/chkconfig httpd on 345
/sbin/chkconfig mysql on 345
#
# Install Drush
#
pear channel-discover pear.drush.org
pear install drush/drush
#
# Set MySQL Root password for the first time
#
mysqladmin -u root password {password_of_your_choice}
# Log in MySQL and create new database
mysql -u root -p
CREATE DATABASE cuhk_morningside;
GRANT ALL PRIVILEGES ON cuhk_morningside.* TO 'cuhk_morningside'@'localhost' IDENTIFIED BY '{password_of_your_choice}';
quit;
# put cuhk_morningside.tar in /var/www/vhosts
# Set up website by Drush
cd /var/www/vhosts
drush archive-restore ./cuhk_morningside.tar --db-url=mysql://cuhk_morningside:{password_of_your_choice}@localhost/cuhk_morningside
# set permissions
chown -R beansbox:beansbox /var/www/vhosts/morningside
<Directory /var/www/vhosts>
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/vhosts/morningside>
Options FollowSymLinks
AllowOverride All
</Directory>
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@morningside.cuhk.edu.hk
DocumentRoot /var/www/vhosts/morningside
ServerName www.morningside.cuhk.edu.hk
ServerAlias morningside.cuhk.edu.hk wwwdev.morningside.cuhk.edu.hk
ErrorLog /var/log/httpd/morningside.cuhk.edu.hk.error_log
CustomLog /var/log/httpd/morningside.cuhk.edu.hk.access_log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment