Most useful work on a server is done by some kind of server software:
- Web (i.e. Apache)
- Database (MySQL)
- Application (LAMP - i.e Moin Moin)
- FTP (i.e. vsftpd)
- Network File System
- Email (i.e. Postfix)
- Etc.
Installing Apache
sudo apt-get install apache2
Apache is installed in /etc/apache2.
File/Directory | Description |
apache2.conf | The main Apache2 configuration file. Contains settings that are global to Apache2. |
conf.d | Contains configuration files which apply globally to Apache. Other packages that use Apache2 to serve content may add files, or symlinks, to this directory. |
envars | File where Apache2 environment variables are set. |
httpd.conf | Historically the main Apache2 configuration file, named after the httpd daemon.The file can be used for user specific configuration options that globally effect Apache2. |
mods-available | This directory contains configuration files to both load modules and configure them. |
mods-enabled | Holds symlinks to the files in /etc/apache2/mods-available. |
ports.conf | Houses the directives that determine which TCP ports Apache2 is listening on. |
sites-available | This directory has configuration files for Apache Virtual Hosts.Virtual Hosts allow Apache2 to be configured for multiple sites that have separate configurations. |
sites-enabled | Like mods-enabled, sites-enabled contains symlinks to the /etc/apache2/sites-available direct |
Virtual hosts listing
/etc/apache2/sites-available/site_name
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
Multiple sites
Apache supports multiple sites on the same machine.
Assign sites by port number, sub-domain, directory name, or any combination of the above.
sudo /etc/init.d/apache2 restart
After any configuration changes,restart Apache
Installing MySQL
sudo apt-get install mysql-server
authentication module
sudo netstat -tap | grep mysql
After installation, check mysql deamon is running
To restart:
sudo /etc/init.d/mysql restart
To configure:
sudo vi /etc/mysql/my.cnf
Create a new database and user
Log on as root (asks for -p password):
mysql -u root
Create a new database:
create database myDB;
Create a new user for the new database:
grant all privileges on myDB.* to ‘newuser’@‘localhost’identified by ‘newpassword’with grant option;
To verify this worked, exit and logon as the new user (no error messages mean all good):
exit;
mysql -u newuser -p #asks for password
use myDB;
Help on installing the whole Lamp:
https://help.ubuntu.com/community/ApacheMySQLPHP