{"id":21,"date":"2016-04-23T22:11:56","date_gmt":"2016-04-24T03:11:56","guid":{"rendered":"https:\/\/servertricks.com\/?p=21"},"modified":"2016-05-08T04:01:34","modified_gmt":"2016-05-08T09:01:34","slug":"install-lamp-server","status":"publish","type":"post","link":"https:\/\/servertricks.com\/index.php\/2016\/04\/23\/install-lamp-server\/","title":{"rendered":"Install LAMP Server"},"content":{"rendered":"<p>This guide assumes you have already installed Ubuntu 16.04.<\/p>\n<p>1. Start by installing openssh if you have not already. <\/p>\n<p><code>$ sudo apt-get update<br \/>\n$ sudo apt-get install openssh-server<\/code><\/p>\n<p>2. Next install apache<\/p>\n<p><code>$ sudo apt-get install apache2<\/code><\/p>\n<p>Enable apache<\/p>\n<p><code>$ sudo systemctl enable apache2<\/code><\/p>\n<p>Start apache<\/p>\n<p><code>$ sudo systemctl start apache2<\/code><\/p>\n<p>You can now check the status of apache to verify it is running<\/p>\n<p><code>$ sudo systemctl status apache2<\/code><\/p>\n<p>3. Now we are ready to move onto installing SQL, there are multiple flavors of SQL that you can install. I prefer mysql over mariadb, because of this I will be walking you through the MYSQL install. <\/p>\n<p>Start by using apt-get to download and install the package<\/p>\n<p><code>$ sudo apt-get install mysql-server mysql-client<\/code><\/p>\n<p>During the install a box will appear asking for you to create your &#8220;root&#8221; MYSQL password, just leave this blank for now. We will be running a script after installation to secure MYSQL. <\/p>\n<p>Once the installation has completed run the following command to secure MYSQL<\/p>\n<p><code>$ mysql_secure_installation<\/code><\/p>\n<p>Here is how I answer the questions in this script:<\/p>\n<pre>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MYSQL\r\n      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!\r\nIn order to log into MYSQL to secure it, we'll need the current\r\npassword for the root user.  If you've just installed MYSQL, and\r\nyou haven't set the root password yet, the password will be blank,\r\nso you should just press enter here.\r\nEnter current password for root (enter for none): \r\nOK, successfully used password, moving on...\r\nSetting the root password ensures that nobody can log into the MYSQL\r\nroot user without the proper authorization.\r\nSet root password? [Y\/n] y\r\nNew password: \r\nRe-enter new password: \r\nPassword updated successfully!\r\nReloading privilege tables..\r\n ... Success!\r\nBy default, a MYSQL installation has an anonymous user, allowing anyone\r\nto log into MYSQL without having to have a user account created for\r\nthem.  This is intended only for testing, and to make the installation\r\ngo a bit smoother.  You should remove them before moving into a\r\nproduction environment.\r\nRemove anonymous users? [Y\/n] \r\n ... Success!\r\nNormally, root should only be allowed to connect from 'localhost'.  This\r\nensures that someone cannot guess at the root password from the network.\r\nDisallow root login remotely? [Y\/n] \r\n ... Success!\r\nBy default, MYSQL comes with a database named 'test' that anyone can\r\naccess.  This is also intended only for testing, and should be removed\r\nbefore moving into a production environment.\r\nRemove test database and access to it? [Y\/n] \r\n - Dropping test database...\r\nERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist\r\n ... Failed!  Not critical, keep moving...\r\n - Removing privileges on test database...\r\n ... Success!\r\nReloading the privilege tables will ensure that all changes made so far\r\nwill take effect immediately.\r\nReload privilege tables now? [Y\/n] \r\n ... Success!\r\nCleaning up...\r\nAll done!  If you've completed all of the above steps, your MYSQL\r\ninstallation should now be secure.\r\nThanks for using MYSQL!<\/pre>\n<p>Congrats we are almost done! Next we need to install php<\/p>\n<p><code>$ sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi  php7.0 libapache2-mod-php7.0<\/code><\/p>\n<p>Next restart the apache service<\/p>\n<p><code>$ sudo systemctl restart apache2<\/code><\/p>\n<p>Verify everything is working by visiting http:\/\/ip-address-of-apache-server <\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide assumes you have already installed Ubuntu 16.04. 1. Start by installing openssh if you have not already. $ sudo apt-get update $ sudo apt-get install openssh-server 2. Next install apache $ sudo apt-get install apache2 Enable apache $ sudo systemctl enable apache2 Start apache $ sudo systemctl start apache2 You can now check [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[10],"class_list":["post-21","post","type-post","status-publish","format-standard","hentry","category-ubuntu","tag-16-04"],"_links":{"self":[{"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/posts\/21","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/comments?post=21"}],"version-history":[{"count":9,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/posts\/21\/revisions"}],"predecessor-version":[{"id":172,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/posts\/21\/revisions\/172"}],"wp:attachment":[{"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/media?parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/categories?post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/servertricks.com\/index.php\/wp-json\/wp\/v2\/tags?post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}