From MEPIS Documentation Wiki

Jump to: navigation, search



LAMP is an acronym for Linux-Apache-MySQL-PHP, a common platform for web applications like forums, blogs, wiki's, and the like. There are many ways to set up a LAMP server on MEPIS, but here is a fairly simple install that uses webmin for setup:

Install software

  1. Open a root console session and run
     apt-get update
  2. Once you are up to date, install the necessary software:
    apt-get install apache2 mysql-server php5 libapache2-mod-php5 php5-mysql
    This will likely install additional packages due to dependencies.
  3. Now, install webmin using the appropriate method (follow link for instructions).

Configure Apache

Set up Webmin Apache module

If you are using MEPIS 7.0 or later with webmin 1.360 or later, everything should be configured automatically. If you get an error about apache not being found, however, click the "module config" link and change the following settings:

File or directory to add virtual servers to = /etc/apache2/sites-available/
Directory to create links in for new virtual servers = /etc/apache2/sites-enabled/
Apache server root directory = /etc/apache2
Path to httpd executable = /usr/sbin/apache2 
Path to the apachectl command = /usr/sbin/apache2ctl
Command to start apache = /etc/init.d/apache2 start
Command to stop apache = /etc/init.d/apache2 stop
Path to httpd.conf or apache2.conf = /etc/apache2/apache2.conf

Apply this configuration and you should see the apache2 configuration page. From here you can configure your apache settings.

Configure MySQL

Root password

First things first: MySQL installs with no root password. Not only is this insecure, but most admin tools (such as webmin) won't even work if you don't have a password. Open a prompt (doesn't have to be root) and enter this command:

mysqladmin -u root -h localhost password "somePassword"

Only come up with a better password in place of "somePassword".

Configure Webmin for MySQL

Open webmin's MySQL tool. You should be at a password prompt. Login as root with the password you previously defined.

If you are using MEPIS 7.0 or later and Webmin 1.360 or later, everything should be configured correctly automatically. If you get an error about it not finding some files, click on "Module Config", and make the following changes:

 Path to mysqlshow command = /usr/bin/mysqlshow
 Path to mysqladmin command = /usr/bin/mysqladmin
 Path to mysql command = /usr/bin/mysql
 Path to mysqldump command = /usr/bin/mysqldump
 Path to mysqlimport command = /usr/bin/mysqlimport
 Path to mysqld command = /usr/sbin/mysqld
 Command to start MySQL server = /etc/init.d/mysql start > /dev/null 2>&1
 Path to MySQL databases directory = /var/lib/mysql/mysql
 MySQL configuration file = /etc/mysql/my.conf

Click "Save" and you should wind up at a login prompt.

Configure PHP

There is not much you need to configure for PHP5, but depending on how you want to use your LAMP server there are a couple of tweaks you might want to make. The PHP5 config file is /etc/php5/apache2/php.ini. The file is extensively self-documenting.

  • Mail: If you need to mail through PHP (such as in a web form, or for notifications), you'll need to first install a mail transport agent (MTA) program. Postfix is one such agent and is recommended (DO NOT use sendmail if this server is on a public network; it is known to be insecure and is highly frowned upon). It can be installed from the repositories:
    apt-get install postfix
    You will need to configure it to relay off of an SMTP server (check with your ISP or network administrator). Finally, locate this line in php.ini:
    Change this line to:
  • Upload Limit: If your LAMP application allows for file uploading, the php.ini file defines the size limitations of uploads. The default is 2 Megabytes. To change this, locate the line:
    upload_max_filesize = 2M
    and change it to whatever you need.
  • Additional modules: There are a few additional modules that extend the functionality of PHP available in the repositories. One of the most popular is php5-gd, a graphics drawing library used by many LAMP applications. To see a list of the modules, search synaptic for "php5-".

Other Recommendations

  • phpmyadmin: PHPmyadmin is one of the most popular web-based administration tools for MySQL. It can be installed from the repostories
    apt-get install phpmyadmin
    If your webroot is still under /var/www, phpmyadmin will automatically install there. You can just go to http://localhost/phpmyadmin after installing it. Log in with the MySQL credentials you set up before.
  • The default webroot for Apache2 on MEPIS is /var/www/. Since MEPIS installer does not provide for putting /var on a separate partition, you may want to move the webroot elsewhere, such as /home/www. Create that directory as root, and change it's ownership to whoever will be maintaining web content. You can then change the webroot in webmin's apache2 tool, or take the lazy approach and simply delete /var/www and create a symlink to /home/www in its place:
    rm -Rf /var/www && ln -s /home/www /var/www
Personal tools
In other languages