32
Installation of LAMP Server with Ubuntu 14.10 Server Edition Sammy Fung [email protected]

Installation of LAMP Server with Ubuntu 14.10 Server Edition

Embed Size (px)

DESCRIPTION

Introducing the installation of LAMP Server with Ubuntu 14.10 Server Edition at Open Source Tech Talk 2014.11.

Citation preview

Page 1: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Installation ofLAMP Server

with Ubuntu 14.10 Server Edition

Sammy [email protected]

Page 2: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Sammy Fung

● Python Developer

● President at Open Source Hong Kong

● Volunteers at Open Source Communities

Page 3: Installation of LAMP Server with Ubuntu 14.10 Server Edition

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

Page 4: Installation of LAMP Server with Ubuntu 14.10 Server Edition

LinuxWeb Server

Page 5: Installation of LAMP Server with Ubuntu 14.10 Server Edition

LAMP

Page 6: Installation of LAMP Server with Ubuntu 14.10 Server Edition

LAMP Stack

● L = Linux

● A = Apache (Web Server)

● M = MySQL (Database Server)

● P = PHP (Programming Language)

Page 7: Installation of LAMP Server with Ubuntu 14.10 Server Edition

LAMP Stack Alternatives

● L = Linux

● A = Apache

● M = MySQL / MariaDB

● P = PHP / Python / Perl

Page 8: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Other Alternatives

● Web Server

– Nginx replacing Apache

● Database

– PostgreSQL replacing MySQL / MariaDB

● Programming Languages

– Ruby, Node.JS

Page 9: Installation of LAMP Server with Ubuntu 14.10 Server Edition

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.

Page 10: Installation of LAMP Server with Ubuntu 14.10 Server Edition

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

Page 11: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Ubuntu 14.10 Server Edition

● Single CD-size image to target Linux installation for serverpurposes.

● 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 April2015.

– 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

Page 12: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Installation Targets

● Physical machines

● Virtual machines

– KVM, Virtualbox, VMware

– Linode

– Amazon Web Service (AWS)

– Google Cloud Service

– Rackspace

– Microsoft Azure

Page 13: Installation of LAMP Server with Ubuntu 14.10 Server Edition

OK! Let's startto install.

Ubuntu 14.10 Server Edition as base system

Page 14: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Linux Operating System

● UNIX-style Operation System

● Command Line Interface (CLI)

● Disk Storages and Filesystems

● Process and memory management

● Networking

● OS managament

Page 15: Installation of LAMP Server with Ubuntu 14.10 Server Edition

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

Page 16: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Command Line Interfaces

● Shell: BASH

● BASH Script: .bashrc

● Redirection: >, >>, <, |, `cmd`

● uname

● SSH

– Secure Remote Shell over SSL SecretCommunication

Page 17: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Disk Storage and Filesystems

● Partitioning: fdisk

● Filesystem: ext4

– mkfs, mount, fsck, mkswap

● File Operation

– ls, pwd, cd, mkdir, rmdir, rm, chmod, chown, find,du, df

– Tar, rsync

Page 18: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Process and Memory Management

● Runlevels 0-6

– /etc/init.d/

● Process Management

– ps, kill

● Memory Management

– free

Page 19: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Networking

● Networking interface

– Ifconfig

– /etc/network/interface

– /etc/resolv.conf

● Routing: route, traceroute

● Packet Filtering (Firewall): iptables

● Monitoring: netstat

● Troubleshooting: ping, host, traceroute

Page 20: Installation of LAMP Server with Ubuntu 14.10 Server Edition

OS Managament

● Software Package: .deb

– dpkg: core package management tool

– apt-get: easier software package tool● apt-get install python

– aptitude: menu-based package tool

Page 21: Installation of LAMP Server with Ubuntu 14.10 Server Edition

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

Page 22: Installation of LAMP Server with Ubuntu 14.10 Server Edition

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;

Page 23: Installation of LAMP Server with Ubuntu 14.10 Server Edition

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

Page 24: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Name-based Virtual Host

<VirtualHost 10.0.2.15:80> ServerName firsttest.sammy.hk.lan ServerAdmin [email protected] 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.logcombined</VirtualHost>

Page 25: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Name-based SSL Virtual Host<VirtualHost *:443> ServerName firsttest.sammy.hk.lan ServerAdmin [email protected] 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.logcombined SSLEngine on SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/certs/ssl-cert-snakeoil.key</VirtualHost>

Page 26: Installation of LAMP Server with Ubuntu 14.10 Server Edition

Apache + PHP5 Installation

● apt-get install apache2

● apt-get install php5

● apt-get install php5-mysql

● apt-get install php5-gd

● cd /etc/apache2/sites-available● vim firsttest.sammy.hk.lan.conf● cd /etc/apache2/sites-enabled● ln -s ../sites-available/firsttest.sammy.hk.lan.conf

● /etc/init.d/apache restart

Page 27: Installation of LAMP Server with Ubuntu 14.10 Server Edition

PHP / Python

● Drupal: PHP Content Management System

● Wordpress: PHP Blog System

● Django: Python Web Framework

Page 28: Installation of LAMP Server with Ubuntu 14.10 Server Edition

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!

Page 29: Installation of LAMP Server with Ubuntu 14.10 Server Edition
Page 30: Installation of LAMP Server with Ubuntu 14.10 Server Edition

LAMP

Page 31: Installation of LAMP Server with Ubuntu 14.10 Server Edition

LAMP Stack

● L = Linux

● A = Apache (Web Server)

● M = MySQL (Database Server)

● P = PHP (Programming Language)

Page 32: Installation of LAMP Server with Ubuntu 14.10 Server Edition

THANK YOU!Sammy Fung <[email protected]>

http://slidesha.re/1tsBbLA

This slide is licensed under Creative Commons BY-NC-SA 3.0