Setting up a turn key system.
Ok, so you have a new VPS. Now what do you do with it?
If you are looking for a pre configured server, there is no one solution.
For many users, a box with a Lamp setup, Linux Apache Mysql and Perl/Php/Python is a good point to start building their server.
Setting up a Lamp box is really quite simple, thanks to the popular Yum package manager that comes with Redhat based distros like Centos or Fedora.
In this tutorial, we will create a Centos 4.3 based box with Apache/Mysql/Php, as well as Webmail, Sendmail, and Ftp. We'll even install the Webmin control panel for an open source cp.
Lets start with the first step. *Install a new stock Centos distro via the QCP. *After your distro installs and the system boots up, login via ssh. *Type the following:
yum install httpd mysql mysql-server php php-mysql dovecot squirrelmail vsftpd
*A large amount of text will scroll by as Yum resolves its depenancies for the above software. Answer Y to the following question.
Transaction Summary Install 18 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 22 M Is this ok [y/N]:
*Yum will download the packages, and install them happily as you instructed it to do so. *When its done, you will be returned to the command prompt. Your software has been installed, lets make sure its running. Type the following to start your daemons up.
service httpd start service vsftpd start service mysqld start... Timeout error occurred trying to start MySQL Daemon. Starting MySQL: [FAILED]
*Oops!!! What happened with Mysql? Rpm based distros have an unfortunate bug associated with them. A few steps will be needed before mysql will start correctly. You will need to run mysql_install_db and edit /etc/my.cnf
/usr/sbin/mysql_install_db Installing all prepared tables Fill help tables
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h vz7.quantact.com password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
The /etc/my.cnf looks like this:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysql.server]
user=mysql
basedir=/var/lib
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Make it look like this:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
skip-innodb
skip-bdb
[mysql.server]
user=mysql
basedir=/var/lib
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Then, type:
service mysqld start service mysqld start Starting MySQL: [ OK ]
*There we go. Now, we need to make a few changes to dovecot to make it run both imap and pop3.
edit /etc/dovecot.conf Turn this:
# Protocols we want to be serving: # imap imaps pop3 pop3s #protocols = imap imaps
into this:
# Protocols we want to be serving: # imap imaps pop3 pop3s protocols = imap imaps pop3
Then start dovecot up.
service dovecot start service dovecot start Starting Dovecot Imap: [ OK ]
*Thats it, you have installed an Linux/Apache/Mysql/Php server, with webmail too boot! *Oh, where is the webmail on the system? Just put your vps's IP in a browser like this:
http://my.ip.add.ress/webmail/
*Lets make sure these daemons start up when then vm boots:
chkconfig --levels 3 httpd on chkconfig --levels 3 mysqld on chkconfig --levels 3 vsftpd on chkconfig --levels 3 dovecot on
*Whats left to do? How about install the Webmin control panel? [http://www.quantact.com/wiki/index.php/Installing_A_Control_Panel Installing a control panel]

