Process for Ubuntu 12.04 LTS
------------------------------------------
Find out IP address
------------------------------------------
ifconfig
------------------------------------------
Install SSH
------------------------------------------
sudo apt-get install openssh-server
-> Now login with SSH using PuTTY using the IP address
-> WinSCP can also now be used to get files onto the server
------------------------------------------
INSTALL WGET
------------------------------------------
sudo apt-get install wget
------------------------------------------
Install compiler tools
------------------------------------------
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
gcc -v
make -v
------------------------------------------
Download Apache Portable Runtime (APR), Apache, PHP and MySQL
------------------------------------------
-> Copy links and paste into PuTTY with right mouse click
wget http://www.bizdirusa.com/mirrors/apache//apr/apr-1.4.6.tar.gz
wget http://mirror.uoregon.edu/apache//apr/apr-util-1.4.1.tar.gz
wget http://zlib.net/zlib-1.2.7.tar.gz
wget http://www.eng.lsu.edu/mirrors/apache//httpd/httpd-2.4.2.tar.gz
wget http://nz.php.net/get/php-5.4.2.tar.gz/from/au.php.net/mirror
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.24.tar.gz/from/ftp://gd.tuwien.ac.at/db/mysql/
-> Fix php filename as it downloaded as 'mirror'
mv mirror php-5.4.2.tar.gz
------------------------------------------
Unpack APR, APR Util, Zlib compression library, Apache and PHP
------------------------------------------
gzip -d apr-1.4.6.tar.gz
tar -xf apr-1.4.6.tar
gzip -d apr-util-1.4.1.tar.gz
tar -xf apr-util-1.4.1.tar
gzip -d apr-1.4.6.tar.gz
tar -xf apr-1.4.6.tar
gzip -d zlib-1.2.7.tar.gz
tar -xf zlib-1.2.7.tar
gzip -d httpd-2.4.2.tar.gz
tar -xf httpd-2.4.2.tar
gzip -d php-5.4.2.tar.gz
tar -xf php-5.4.2.tar
------------------------------------------
Install Perl Compatible Regular Expressions (Apache dependency)
------------------------------------------
sudo apt-get install libpcre3 libpcre3-dev
------------------------------------------
Install ZLIB compression library
------------------------------------------
cd zlib-1.2.7
./configure
make
sudo make install
cd ..
------------------------------------------
Move APR files to apache dependencies dir
------------------------------------------
pwd
-> replace /home/testserver/ with the actual working dir
mv/home/testserver/apr-1.4.6 /home/testserver/httpd-2.4.2/srclib/apr
mv/home/testserver/apr-util-1.4.1 /home/testserver/httpd-2.4.2/srclib/apr-util
------------------------------------------
Now finally install Apache
------------------------------------------
cd httpd-2.4.2/
./configure --enable-so --with-mpm=worker --enable-rewrite --enable-deflate --with-included-apr --with-included-apr-util
------------------------------------------
Configure Apache
------------------------------------------
sudo nano /usr/local/apache2/conf/httpd.conf
-> Edit the following line and set to:
ServerName localhost
-> save file and write out
-> start Apache to test
/usr/local/apache2/bin/apachectl start
-> browse to http://server ip address/ to test
------------------------------------------
Configure MySQL
------------------------------------------
sudo apt-get install mysql-server
-> Test it is running
sudo netstat -tap | grep mysql
-> Generate MySQL optimisation config from https://tools.percona.com/wizard/result
-> Edit and add config to my.cnf file
sudo nano /etc/mysql/my.cnf
sudo service mysql restart
-> Test connection with SQLYog
SSH tab:
Tick: Use SSH tunneling
SSH host address: IP of the server
Username: Username on server
SSH port: 22
MySQL tab:
MySQL host address: localhost
Username: root
Password: password used on setup
Port: 3306
------------------------------------------
Configure PHP
------------------------------------------
sudo apt-get install libxml2-dev
./configure --without-pear --with-zlib --enable-fpm --with-fpm-user=www --enable-cgi --with-fpm-group=www --with-mysql-sock=/var/run/mysqld/mysqld.sock;
make
make install
make test
cp php.ini-production /usr/local/lib/php.ini
httpd: Syntax error on line 145 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot open shared object file: No such
file or directory
------------------------------------------
Configure MySQL prerequisites
------------------------------------------
-> install ncurses programming library
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
tar xzf ncurses-5.9.tar.gz
cd ncurses-5.9
./configure --prefix=/opt/ncurses
make
sudo make install
ls -la /opt/ncurses
-> install m4 Macro Processor
wget ftp://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.gz
tar -xvzf m4-1.4.16.tar.gz
cd m4-1.4.16
./configure --prefix=/usr/local/m4
sudo make install
-> install Bison (GNU Parser Generator)
wget http://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
tar -xvzf bison-2.5.tar.gz
cd bison-2.5
PATH=$PATH:/usr/local/m4/bin/
./configure --prefix=/usr/local/bison --with-libiconv-prefix=/usr/local/libiconv/
make
sudo make install
-> install CMake (cross-platform, open-source build system)
wget http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz
tar xzf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure --prefix=/opt/cmake
make
sudo make install
/opt/cmake/bin/cmake -version
-> install libaio (Kernel Asynchronous I/O (AIO) Support)
cd /opt
sudo wget http://www.morphisms.net/~wkj/download/libaio.tbz
sudo bunzip2 libaio.tbz
sudo tar xf libaio.tar
cd ~
------------------------------------------
Configure MySQL finally
------------------------------------------
tar xzf mysql-5.5.23.tar.gz
cd mysql-5.5.23
PATH=$PATH:/usr/local/bison/bin
/opt/cmake/bin/cmake . -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/opt/mysql-5.5.24/data/ \
-DCMAKE_INSTALL_PREFIX=/opt/mysql-5.5.24 -DCURSES_LIBRARY=/opt/ncurses/lib/libncurses.a \
-DCURSES_INCLUDE_PATH=/opt/ncurses/include/ -DHAVE_LIBAIO_H=/opt/libaio/include/ \
-DINSTALL_LAYOUT=STANDALONE -DENABLED_PROFILING=ON \
-DMYSQL_MAINTAINER_MODE=OFF -DWITH_DEBUG=OFF
make
make install
-> Installs correctly but won't run because of sock error