How To Install Linux, Apache, My. SQL, PHP (LAMP) stack on Ubuntu 1. Introduction. A "LAMP" stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. ![]() The site data is stored in a My. SQL database, and dynamic content is processed by PHP. In this guide, we'll get a LAMP stack installed on an Ubuntu 1. Droplet. Ubuntu will fulfill our first requirement: a Linux operating system.
![]() Prerequisites. Before you begin with this guide, you should have a separate, non- root user account with sudo privileges set up on your server. You can learn how to do this by completing steps 1- 4 in the initial server setup for Ubuntu 1. Step 1: Install Apache and Allow in Firewall. The Apache web server is among the most popular web servers in the world. It's well- documented, and has been in wide use for much of the history of the web, which makes it a great default choice for hosting a website. We can install Apache easily using Ubuntu's package manager, apt. A package manager allows us to install most software pain- free from a repository maintained by Ubuntu. This tutorial shows how you can install an Apache webserver on a CentOS 7 server with PHP support (mod_php) and MySQL support. LAMP is short for Linux, Apache, MySQL. You can learn more about how to use apt here. For our purposes, we can get started by typing these commands: sudo apt- get update. Since we are using a sudo command, these operations get executed with root privileges. It will ask you for your regular user's password to verify your intentions. Once you've entered your password, apt will tell you which packages it plans to install and how much extra disk space they'll take up. Press Y and hit Enter to continue, and the installation will proceed. Set Global Server. Name to Suppress Syntax Warnings. Next, we will add a single line to the /etc/apache. While harmless, if you do not set Server. Name globally, you will receive the following warning when checking your Apache configuration for syntax errors: sudo apache. Output. AH0. 05. 58: apache. Could not reliably determine the server's fully qualified domain name, using 1. Install Wordpress On Linux Lamp Installation On Ubuntu![]() Set the 'Server. Name' directive globally to suppress this message. Open up the main configuration file with your text edit: sudo nano /etc/apache. Inside, at the bottom of the file, add a Server. Name directive, pointing to your primary domain name. If you do not have a domain name associated with your server, you can use your server's public IP address: Note. If you don't know your server's IP address, skip down to the section on how to find your server's public IP address to find it./etc/apache. Server. Name server_domain_or_IPSave and close the file when you are finished. Next, check for syntax errors by typing: sudo apache. Since we added the global Server. Name directive, all you should see is: Output. Syntax OK. Restart Apache to implement your changes: sudo systemctl restart apache. You can now begin adjusting the firewall. Adjust the Firewall to Allow Web Traffic. Next, assuming that you have followed the initial server setup instructions to enable the UFW firewall, make sure that your firewall allows HTTP and HTTPS traffic. You can make sure that UFW has an application profile for Apache like so: Output. Available applications. Apache. Apache Full. Apache Secure. If you look at the Apache Full profile, it should show that it enables traffic to ports 8. Apache Full". Output. Profile: Apache Full. Title: Web Server (HTTP,HTTPS). Description: Apache v. Apache web. 8. 0,4. Allow incoming traffic for this profile: sudo ufw allow in "Apache Full". You can do a spot check right away to verify that everything went as planned by visiting your server's public IP address in your web browser (see the note under the next heading to find out what your public IP address is if you do not have this information already): http: //your_server_IP_address. You will see the default Ubuntu 1. Apache web page, which is there for informational and testing purposes. It should look something like this: If you see this page, then your web server is now correctly installed and accessible through your firewall. How To Find your Server's Public IP Address. If you do not know what your server's public IP address is, there are a number of ways you can find it. Usually, this is the address you use to connect to your server through SSH. From the command line, you can find this a few ways. First, you can use the iproute. This will give you two or three lines back. They are all correct addresses, but your computer may only be able to use one of them, so feel free to try each one. An alternative method is to use the curl utility to contact an outside party to tell you how it sees your server. You can do this by asking a specific server what your IP address is: sudo apt- get install curl. Regardless of the method you use to get your IP address, you can type it into your web browser's address bar to get to your server. Step 2: Install My. SQLNow that we have our web server up and running, it is time to install My. SQL. My. SQL is a database management system. Basically, it will organize and provide access to databases where our site can store information. Again, we can use apt to acquire and install our software. This time, we'll also install some other "helper" packages that will assist us in getting our components to communicate with each other: sudo apt- get install mysql- server. Note: In this case, you do not have to run sudo apt- get update prior to the command. This is because we recently ran it in the commands above to install Apache. The package index on our computer should already be up- to- date. Again, you will be shown a list of the packages that will be installed, along with the amount of disk space they'll take up. Enter Y to continue. During the installation, your server will ask you to select and confirm a password for the My. SQL "root" user. This is an administrative account in My. SQL that has increased privileges. Think of it as being similar to the root account for the server itself (the one you are configuring now is a My. SQL- specific account, however). Make sure this is a strong, unique password, and do not leave it blank. When the installation is complete, we want to run a simple security script that will remove some dangerous defaults and lock down access to our database system a little bit. Start the interactive script by running: mysql_secure_installation. You will be asked to enter the password you set for the My. SQL root account. Next, you will be asked if you want to configure the VALIDATE PASSWORD PLUGIN. Warning: Enabling this feature is something of a judgment call. If enabled, passwords which don't match the specified criteria will be rejected by My. SQL with an error. This will cause issues if you use a weak password in conjunction with software which automatically configures My. SQL user credentials, such as the Ubuntu packages for php. My. Admin. It is safe to leave validation disabled, but you should always use strong, unique passwords for database credentials. Answer y for yes, or anything else to continue without enabling. VALIDATE PASSWORD PLUGIN can be used to test passwords. It checks the strength of password. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No. You'll be asked to select a level of password validation. Keep in mind that if you enter 2, for the strongest level, you will receive errors when attempting to set any password which does not contain numbers, upper and lowercase letters, and special characters, or which is based on common dictionary words. There are three levels of password validation policy. LOW Length > = 8. MEDIUM Length > = 8, numeric, mixed case, and special characters. STRONG Length > = 8, numeric, mixed case, special characters and dictionary file. Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1. If you enabled password validation, you'll be shown a password strength for the existing root password, and asked you if you want to change that password. If you are happy with your current password, enter n for "no" at the prompt: Using existing password for root. Estimated strength of the password: 1. Change the password for root ? Press y|Y for Yes, any other key for No) : n. For the rest of the questions, you should press Y and hit the Enter key at each prompt. This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that My. SQL immediately respects the changes we have made.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
October 2017
Categories |