how to install lamp stack on ubuntu 15.10 _ unixmen

Upload: luis-ito

Post on 06-Jul-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    1/16

    2

    LAMP   is a combination of operating system and open-source software stack. The acronym

    LAMP came from the first letters of Linux, A pache TTP !er"er, M y!#L or Maria$% database,

    and PP&Perl&P ython. This tutorial describes how to install LAMP stack on 'buntu ().(*,

    howe"er the steps described below should work on pre"ious 'buntu "ersions such as 'buntu

    ().*+&(+.(*&(+.*+&(.(* etc.

    Install LAMP Stack On Ubuntu 15.10

    1. Install Apache

     Apache is an open-source multi-platform web ser"er. t pro"ides a full range of web ser"er

    features including /, !!L and "irtual domains.

    To install Apache, enter0

    !1 

    How To Install LAMP Stack On Ubuntu 15.10

    2T2%34 56, 5*()

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    2/16

    sudo apt-get install apache2

    Test Apache:

    2pen your web browser and na"igate to http://localhost/ or http://server-ip-address/.

    2. Install MS!L

    MySQL is a relational database management system 74$%M!8 that runs as a ser"er pro"iding

    multi-user access to a number of databases, though !#Lite probably has more total embedded

    deployments

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    3/16

    sudo apt-get install mysql-server mysql-client

    $uring installation, you9ll be asked to setup the My!#L :root; user password. 3nter the

    password and click 2k.

    4e-enter the password.

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    4/16

    My!#L is installed now.

     

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    5/16

    =irst you ha"e to remo"e existing My!#L packages if any. To completely uninstall My!#L along

     with its configuration files, enter the following commands one by one0

    sudo systemctl stop mysql

    sudo apt-get remove --purge mysql-server mysql-client mysql-common

    sudo apt-get autoremove

    sudo apt-get autoclean

    sudo rm -rf /var/lib/mysql/

    sudo rm -rf /etc/mysql/

     After remo"ing My!#L, run the following command to install Maria$%.

    sudo apt-get install mariadb-server

     Alternati"ely, you can install it using Maria$% repository  if you want to try most recent "ersion

    of Maria$%. 4un the following commands to add PPA. As of writing this, Maria$% PPA is not

     yet updated to 'buntu ().*+. owe"er, we can use the repository of 'buntu (+.(* instead.

    sudo apt-get install software-properties-common

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    6/16

    sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80

    0xcbcb082a1bb943db

    sudo add-apt-repository 'deb http://download.nus.edu.sg/mirror/mariadb/repo/10.1/ubuntu vivid main'

    'pdate the software sources list and install Maria$% using following commands0

    sudo apt-get update

    sudo apt-get install mariadb-server

    $uring installation you will be asked to set mys>l ?root9 user password. 3nter the password

    twice, and complete the installation.

    %&portant 'ote: n 'buntu ().(*&().*+, Maria$% won9t ask you to set root user password

    during installation.

     Also, you can9t set password manually using the following command too0

    mysql_secure_installation

    t will throw the following error.

    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

    SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

    In order to log into MariaDB to secure it, we'll need the current

    password for the root user. If you've just installed MariaDB, and

    you haven't set the root password yet, the password will be blank,

    so you should just press enter here.Enter current password for root (enter for none):

    ERROR 1698 (28000): Access denied for user 'root'@'localhost'

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    7/16

    Enter current password for root (enter for none):

    To fix this error, log in to mys>l prompt without password as root user0

    sudo mysql -u root

    Then, run the following commands one by one in the mys>l prompt0

    use mysql;

    update user set plugin='' where User='root';

    flush privileges;

    \q

    That9s it. @ow, set database administrati"e :root; user password using command. Press 3nter

    and go with the default settings.

    mysql_secure_installation

    !ample output0

    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

      SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

    In order to log into MariaDB to secure it, we'll need the current

    password for the root user. If you've just installed MariaDB, and

    you haven't set the root password yet, the password will be blank,

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    8/16

    so you should just press enter here.

    Enter current password for root (enter for none):

    OK, successfully used password, moving on...

    Setting the root password ensures that nobody can log into the MariaDB

    root user without the proper authorisation.

    Set root password? [Y/n] y

    New password:

    Re-enter new password:

    Password updated successfully!

    Reloading privilege tables..

     ... Success!

    By default, a MariaDB installation has an anonymous user, allowing

    anyone

    to log into MariaDB without having to have a user account created for

    them. This is intended only for testing, and to make the installation

    go a bit smoother. You should remove them before moving into a

    production environment.

    Remove anonymous users? [Y/n]

    ... Success!Normally, root should only be allowed to connect from 'localhost'.

    This

    ensures that someone cannot guess at the root password from the

    network.

    Disallow root login remotely? [Y/n]

    ... Success!

    By default, MariaDB comes with a database named 'test' that anyone can

    access. This is also intended only for testing, and should be removed

    before moving into a production environment.

    Remove test database and access to it? [Y/n]

    - Dropping test database...

    ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database

    doesn't exist

     ... Failed! Not critical, keep moving...

     - Removing privileges on test database...

     ... Success!

    Reloading the privilege tables will ensure that all changes made so far

    will take effect immediately.

    Reload privilege tables now? [Y/n]

    ... Success!

    Cleaning up...All done! If you've completed all of the above steps, your MariaDB

    installation should now be secure.

    Thanks for using MariaDB!

    heck if mariadb is running or not, using the following command0

    sudo service mysql status

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    9/16

    !ample output0

    ● mysql.service - LSB: Start and stop the mysql database server daemonLoaded: loaded (/etc/init.d/mysql)

     Active: active (running) since Mon 2015-10-26 14:26:36 IST; 2min 5s

    agoDocs: man:systemd-sysv-generator(8)

    CGroup: /system.slice/mysql.service

    ├─6387 /bin/bash /usr/bin/mysqld_safe├─6388 logger -p daemon err -t /etc/init.d/mysql -i└─6544 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --...Oct 26 14:26:39 server /etc/mysql/debian-start[6595]:

    mysql.time_zone_transit...

    Oct 26 14:26:39 server /etc/mysql/debian-start[6595]:

    mysql.time_zone_transit...

    Oct 26 14:26:39 server /etc/mysql/debian-start[6595]: mysql.user ...

    Oct 26 14:26:39 server /etc/mysql/debian-start[6595]: Phase 2/6:

    Fixing views

    Oct 26 14:26:39 server /etc/mysql/debian-start[6595]: Processing

    databases

    Oct 26 14:26:39 server /etc/mysql/debian-start[6595]:

    information_schema

    Oct 26 14:26:39 server /etc/mysql/debian-start[6595]: mysql

    Oct 26 14:26:39 server /etc/mysql/debian-start[6595]:

    performance_schema

    Oct 26 14:26:39 server /etc/mysql/debian-start[6653]: Checking for

    insecure r...

    Oct 26 14:26:39 server /etc/mysql/debian-start[6657]: Triggering

    myisam-recov...

    Hint: Some lines were ellipsized, use -l to show in full.

    '. Install PHP

    P(P   7recursi"e acronym for PP0 ypertext Preprocessor8 is a widely used open-source

    general purpose scripting language that is especially suited for web de"elopment and can be

    embedded into TML.

    nstall PP with following command0

    sudo apt-get install php5 php5-mysql libapache2-mod-php5

    To test PP, create a sample :testphp.php; file in Apache document root folder.

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    10/16

    sudo nano /var/www/html/testphp.php

     Add the following lines0

    4estart apache5 ser"ice.

    2n 'buntu ().(*&().*+0

    sudo systemctl restart apache2

    2n 'buntu (+.(* and lower "ersions0

    sudo service apache2 restart

    @a"igate to http://server-ip-address/testphpphp. t will display all the details about php

    such as "ersion, build date and commands etc.

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    f 16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    11/16

    f you want to install all php modules at once, enter the command sudo apt-)et install php*

    and restart the apache5 ser"ice. To "erify the modules, open web browser and na"igate to

    http://server-ip-address/testphpphp.

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    12/16

    3nter password of the database9s administrati"e user.

    3nter My!#L application password for phpmyadmin0

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    f 16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    13/16

    4e-enter password0

    !uccessC phpMyAdmin installation is installed.

     Additional 'ote: if you followed all steps carefully, phpMyAdmin should work Bust fine. n

    case phpMyAdmin is not working, please do the following steps.

    2pen terminal, and type0

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    f 16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    14/16

    sudo nano /etc/apache2/apache2.conf

     Add the following line at the end.

    Include /etc/phpmyadmin/apache.conf

    !a"e and 3xit. 4estart apache ser"ice0

    On Ubuntu 151!/15!":

    sudo systemctl restart apache2

    On Ubuntu 1"1! and lo+er versions:

    sudo /etc/init.d/apache2 restart

    -. Access phpMA+,$n eb /onsole

    @ow, you can access the phpmyadmin console by na"igating to http://server-ip-address

    /php&yad&in/ from your browser.

    3nter your My!#L username and password which you ha"e gi"en in pre"ious steps. n my case

    its :root; and :ubuntu;.

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/

    f 16 29/10/2015 00:35

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    15/16

    P2!T3$ @0 =43#'3@TL< A!13$ #'3!T2@! L@'D T'T24AL! !2=TA43 '%'@T'

    TA//3$0 APA3 LAMP !34E34 LAMP !TA1 MA4A$% M

  • 8/17/2019 How to Install LAMP Stack on Ubuntu 15.10 _ Unixmen

    16/16

    opyright 'nixmen 5*(6

    Ghostery blocked comments powered by Disqus.

     

    P#e3$ous sto#4e"iew of =edora 5

    4et sto#nstall 1loxo-M4 ontrol Panel n ent2!

    w To Install LAMP Stack On Ubuntu 15.10 | Unixmen http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/