Web Hosting Talk







View Full Version : HowTo - Install a basic LAMP box


tim doyle
08-16-2006, 01:56 PM
Ok, so you have a new VPS. Now what do you do with it?

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 howto, we will create a Centos 4.3 based box with Apache/Mysql/Php,
as well as Webmail, and Vsftp.

Lets start with the first step.

* Install a new stock Centos distro via your hosting providers control panel.
* After your distro installs and the system boots up, login via ssh.
* Type the following:

yum install httpd mysql mysql-server php php-mysql sendmail dovecot squirrelmail vsftpd

* A large amount of text will scroll by as Yum resolves its dependancies 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 edit /etc/my.cnf

It 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
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
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


Thats it! You now have a basic LAMP server up and running.
This could be improved apon by installing an open source control panel like Webmin.

bubazoo
08-30-2006, 08:22 PM
Can someone post how to check to see if Dovecot is functioning correctly?

on my test server here at home, running centOS 4.3, after enabling dovecot, I am not able to access pop3 at all..

I was just wondering, if this could be a port 25 block, and if it is, how would I find out? I tried ssh'ing into port 25, and I got thru, so what else could it be perhaps? I'm just not able to login via pop3, I haven't tried logging in by imap yet, as I don't have an imap email client I don't think. I can retrieve local mail on the server ok, just not pop3 for some reason can't seem to figure it out.

as for mysql failing first time, I never had that problem, but I also had to run

mysqladmin -u root password "yourpassword"

where "yourpassword" is the root password for mysql.

thanks

PS: another recommendation for a tutorial here, instructions on how to compile PHP from scratch.. specifically, installing PHP 4 with pspell and GD support, which GD specifically requires compiling from scratch I was told. so a tutorial on that would be very helpful

tim doyle
08-30-2006, 08:28 PM
Hi Bubazoo.

Dovecot runs on port 110 for pop3, so you will want to check there instead of port 25.

You'll want to make sure your /etc/dovecot.conf has the following change:

# Protocols we want to be serving:
# imap imaps pop3 pop3s
#protocols = imap imaps

should be this:

# Protocols we want to be serving:
# imap imaps pop3 pop3s
protocols = imap imaps pop3


Then restart dovecot.

To check if its running, you can

telnet my.ip.add.ress 110

You should be greeted with the dovecot banner.

Let me know if you have any other questions.

-Tim

ezXEN
09-17-2006, 02:45 AM
Just wanted to add:

yum -y install gd-devel
(gd libraries, might not be the latest)
yum -y install curl-devel
(cURL)

gnileux
09-28-2006, 12:41 AM
Will a 128Mb RAM VPS be able to support LAMP?

Dougy
09-28-2006, 08:34 PM
Will a 128Mb RAM VPS be able to support LAMP?

It could.. however more is better.

bubazoo
10-11-2006, 09:10 PM
could someone post how to install a LAMP manually?

what I'm wanting is apache2
PHP 5 with gd, pspell, zlib compression, and imageMagick minimum
and mysql

mostly. thanks. I tried reading the PHP manual, and doing google searches, but found mixed search results, and I'm not sure whats the "correct" way of doing it.

thanks.

bubazoo
11-04-2006, 12:03 PM
could someone please post how to setup a LAMP server, on a distro that doesn't have yum or apt?

I want to learn how to setup a LAMP server without using yum.

I have tried google searching, with mixed results, and all the guides I find assume you have yum or apt, and was just wondering if someone could post a quick guide to installing a LAMP server without using a package manager?

preferably apache2, PHP 4 or 5, and mysql 4,
That would really help alot of us VPS'rs, esp since alot of VPS's don't have yum or apt.

thanks

Jeremy
11-10-2006, 11:41 AM
http://webhostingtalk.com/showthread.php?t=522376

Might be what your looking for.