Installation of LAMP Server with Ubuntu 14.10 Server Edition
1. Installation of
LAMP Server
with Ubuntu 14.10 Server Edition
Sammy Fung
sammy@sammy.hk
2. Sammy Fung
● Python Developer
● President at Open Source Hong Kong
● Volunteers at Open Source Communities
3. Linux Certifications
● Linux Professional Institute
– Level 1: Perform Maintenance tasks.
– Level 2: Administrate Small-medium mixed network.
– Level 3: New enterprise-level.
● Linux Foundation (New)
– LFCS: System Admins
– LFCE: Engineers
6. LAMP Stack
● L = Linux
● A = Apache (Web Server)
● M = MySQL (Database Server)
● P = PHP (Programming Language)
7. LAMP Stack Alternatives
● L = Linux
● A = Apache
● M = MySQL / MariaDB
● P = PHP / Python / Perl
8. Other Alternatives
● Web Server
– Nginx replacing Apache
● Database
– PostgreSQL replacing MySQL / MariaDB
● Programming Languages
– Ruby, Node.JS
9. Step-by-Step Install Demosration
● Linux: Ubuntu 14.10 Server Edition
– Base system with SSH server.
● MySQL database system
● Apache web server + PHP
– Apache PHP module.
– PHP libraries
– Drupal: PHP Content Management System.
10. Linux
● Linux = Linux Kernel
● Linux distributions (distros)
– Linux Kernel + System Tools + Application Progams
– Red Hat and RPM-based
● Red Hat Enterprise Linux
● Fedora, CentOS
● SuSE, OpenSuSE
– Debian and DEB-based
● Debian
● Ubuntu
11. Ubuntu 14.10 Server Edition
● Single CD-size image to target Linux installation for server
purposes.
● Non-LTS version: 9-month support cycle.
– Upgrade to next version after support cycle (July 2015).
– Next version 15.04 Vivid Vervet (non-LTS) will be released in April
2015.
– LTS versioon 14.04 (Trusty Tahr) supports till April 2019.
● Linux Kernel 3.16
● OpenStack 2014.2 (Juno) release in main repo.
● Docker 1.2
12. Installation Targets
● Physical machines
● Virtual machines
– KVM, Virtualbox, VMware
– Linode
– Amazon Web Service (AWS)
– Google Cloud Service
– Rackspace
– Microsoft Azure
13. OK! Let's start
to install.
Ubuntu 14.10 Server Edition as base system
14. Linux Operating System
● UNIX-style Operation System
● Command Line Interface (CLI)
● Disk Storages and Filesystems
● Process and memory management
● Networking
● OS managament
15. UNIX-Style Operating System
● Users and Groups
– Super User (Admin): root
● su, sudo, id
– useradd, usermod, userdel.
– groupadd, groupmod, groupdel.
– /etc/passwd, /etc/shadow
● Everything is file.
– Filesystem Structure
● /dev, /etc, /home, /var
16. Command Line Interfaces
● Shell: BASH
● BASH Script: .bashrc
● Redirection: >, >>, <, |, `cmd`
● uname
● SSH
– Secure Remote Shell over SSL Secret
Communication
21. MySQL
● RDBMS: Relationship-based Database System
● CLI Client: mysql -u username -p
● Config File /etc/my.cnf
● SQL
– CREATE DATABASE / TABLE / USER, GRANT
– FLUSH PRIVILEGES
– USE databasename
– SHOW DATABASES / TABLES
– INSERT, UPDATE, DELETE
22. MySQL
● apt-get install mysql-server
● mysql -u root -p
– CREATE DATABASE mydrupal;
– CREATE USER mydrupal@localhost identified by
'opensource.hk';
– GRANT ALL ON mydrupal.* to mydrupal@localhost;
– FLUSH PRIVILEGES;
23. Apache
● HTTP server
– HTTP = web protocol
● Installation and Configuration
– Setting up name-based virtual web hosts
– Configure Apache log files
– Restrict access to a web page with Apache
– Modules: SSL, Userdir, rewrite
● PHP
– MySQL, SMTP
● Postfix SMTP server
24. Name-based Virtual Host
<VirtualHost 10.0.2.15:80>
ServerName firsttest.sammy.hk.lan
ServerAdmin webmaster@sammy.hk
DocumentRoot /home/sammy/www
<Directory "/home/sammy/www">
AllowOverride All
Options Indexes FollowSymLinks
order allow,deny
allow from all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/firsttest.sammy.hk.lan-error.log
CustomLog ${APACHE_LOG_DIR}/firsttest.sammy.hk.lan-access.log
combined
</VirtualHost>
25. Name-based SSL Virtual Host
<VirtualHost *:443>
ServerName firsttest.sammy.hk.lan
ServerAdmin webmaster@sammy.hk
DocumentRoot /home/sammy/www
<Directory "/home/sammy/www">
AllowOverride All
Options Indexes FollowSymLinks
order allow,deny
allow from all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/firsttest.sammy.hk.lan-error.log
CustomLog ${APACHE_LOG_DIR}/firsttest.sammy.hk.lan-access.log
combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/certs/ssl-cert-snakeoil.key
</VirtualHost>
27. PHP / Python
● Drupal: PHP Content Management System
● Wordpress: PHP Blog System
● Django: Python Web Framework
28. Drupal basic installation
● Download and uncompress Drupal tarball to DocumentRoot
– cp sites/default/default/settings.php sites/default/settings.php
– mkdir sites/default/files
– chmod a+w sites/default/settings.php sites/default/files
● At web browser,
– http://firsttest.sammy.hk.lan/
– Add above hostname to host files on your client machine, eg. /etc/hosts
– Use port 8080 at VirtualBox port forwarding to port 80
● Go thru step-by-step installation.
● DONE!