Firstly, you need to create a new Cloud Server instance in the Rackspace control panel. For this tutorial, I'm using a 1024MB server with CentOS 5.6 as the operating system. This is a 64bit install.
Any lines in this tutorial starting with # should be typed at the command prompt.
Once your server is active, log on via SSH as root.
Firstly, we need to create a directory to store our downloaded files in:
Once you have uploaded the package, we can grab a couple of repositories. We can use wget for these which makes our lives much easier.
I have attached a shell script called iptables.sh that can be used to configure a simple but secure setup that will allow access to only SSH, Apache and Zend. The script is based on the documentation in the Centos Wiki I linked to above, so it should be easy to understand.
Create the script by pasting the code below to /usr/sbin using vi. vi /usr/sbin/iptables.sh
http://yourip:10081
You should see the Zend control panel here and be able to proceed to configuring your Zend installation.
The order of the names is actually really important here if you want to install sendmail later. Sendmail wants to see the fully qualified names first, otherwise you will experience massive latency every time you restart the server or need to send emails.
Next, set the hostname:
Save and exit. Then restart the network service.
Any lines in this tutorial starting with # should be typed at the command prompt.
Once your server is active, log on via SSH as root.
Firstly, we need to create a directory to store our downloaded files in:
- mkdir Downloads
- cd Downloads
Once you have uploaded the package, we can grab a couple of repositories. We can use wget for these which makes our lives much easier.
- wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
- wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm or wget ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
- tar -xzf ZendServer-5.1.0-RepositoryInstaller-linux.tar.gz
- cd ZendServer-RepositoryInstaller-linux/
- ./install_zs.sh 5.3 ce
- yum install -y php-5.3-extra-extensions-zend-server zend-server-framework-extras
- yum install mysql-server
- service mysqld start
- mysql_install_db
- /usr/bin/mysql_secure_installation
- chkconfig --levels 235 mysqld on
- cd ~/Downloads
- rpm -Uh remi-release-5.rpm epel-release-5-4.noarch.rpm
- vi /etc/yum.repos.d/remi.repo
- yum install phpmyadmin-zend-server-php-5.3
- cp /usr/local/zend/gui/lighttpd/htdocs/phpmyadmin/config.sample.inc.php /usr/local/zend/gui/lighttpd/htdocs/phpmyadmin/config.inc.php
- vi /usr/local/zend/gui/lighttpd/htdocs/phpmyadmin/config.inc.php
- vi /usr/local/zend/gui/lighttpd/etc/lighttpd.conf
$HTTP["remoteip"] !~ "127.0.0.1" {
$HTTP["url"] =~ "^/phpmyadmin/" {
url.access-deny = ( "" )
server.errorfile-prefix = "//usr/local/zend/gui/lighttpd/share/lighttpd-custom-errors/errorcode-"
}
}
To disable the security completely, you can simply comment out this block. Alternatively, just replace the IP Address with your own. Finally, we need to add Zend's bin and lib directories to the system path and restart Zend.- vi /etc/profile
PATH=$PATH:/usr/local/zend/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib
Save and exit - then read the new profile in to memory and restart Zend:- source /etc/profile
- zendctl.sh restart
Configure the firewall using IPTables
To explain how IPTables works with all the possible options is beyond the scope of this document. However, there is an excellent introduction to the topic here: http://wiki.centos.org/HowTos/Network/IPTables.I have attached a shell script called iptables.sh that can be used to configure a simple but secure setup that will allow access to only SSH, Apache and Zend. The script is based on the documentation in the Centos Wiki I linked to above, so it should be easy to understand.
Create the script by pasting the code below to /usr/sbin using vi. vi /usr/sbin/iptables.sh
#!/bin/bash
#
# iptables example configuration script
#
# Flush all current rules from iptables
#
iptables -F
#
# Allow SSH connections on tcp port 22
# This is essential when working on remote servers via SSH to prevent locking yourself out of the system
#
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
#
# Allow access to Zend Server default ports (http and https)
#
iptables -A INPUT -p tcp --dport 10081:10082 -j ACCEPT
#
# Allow access to apache (http and https)
#
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
#
# Set default policies for INPUT, FORWARD and OUTPUT chains
#
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
#
# Set access for localhost
#
iptables -A INPUT -i lo -j ACCEPT
#
# Accept packets belonging to established and related connections
#
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#
# Save settings
#
/sbin/service iptables save
#
# List rules
#
iptables -L -v
Give the root user execute permissions on the file:- chown root iptables.sh
- chmod u+x iptables.sh
- ./iptables.sh
http://yourip:10081
You should see the Zend control panel here and be able to proceed to configuring your Zend installation.
Configure localtime and ntpd
- yum install -y ntp
- cd /etc
- ln -sf /usr/share/zoneinfo/GB localtime
- chkconfig ntpd on
- ntpdate pool.ntp.org
- service ntpd start
Configure your hostname
Rather than just running your server under an IP address, you should also configure a hostname. For this example, we will assume that your server IP address is 46.10.11.12 and you have pointed host.my-server.net at that IP address.- vi /etc/hosts
The order of the names is actually really important here if you want to install sendmail later. Sendmail wants to see the fully qualified names first, otherwise you will experience massive latency every time you restart the server or need to send emails.
Next, set the hostname:
- vi /etc/sysconfig/network
Save and exit. Then restart the network service.
- service network restart
No comments:
Post a Comment