• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

How to Install Apache, MySQL and PHP on Ubuntu 17.04

How VPS by How VPS
January 1, 2020
in Linux
0
0
SHARES
32
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Step 1: Install Apache
  2. Step 2: Install MySQL
  3. Step 3: Install PHP
  4. Step 4: Start Apache and MySQL on boot
  5. Additional Information
    1. Firewall Configuration
    2. Conclusion
  6. Want to contribute?


In this article, I will explain how to create a LAMP stack on Ubuntu 17.04.

Note: You will need sudo or root access for the commands in this article. If you’ve already escalated to the root user, you may omit the sudo command.

Step 1: Install Apache

First, update your package manager.

sudo apt-get update -y #using the -y option will automatically accept the conditions of the source update
sudo apt-get install apache2 -y #install apache
sudo systemctl start apache2.service #start apache

Alternatively, if you’d like to run everything at once, execute this.

sudo sh -c "apt-get update -y; apt-get install apache2 -y; systemctl start apache2.service"

Verify that Apache was installed without errors by accessing it from your local browser. Enter hostname -I to obtain your IP address for the server and navigate to http://SERVER_IP/.

Step 2: Install MySQL

Enter this into the shell prompt.

sudo apt-get install mysql-server -y

This will promptly install the MariaDB database server (a fork of MySQL). You will be asked to enter a password for the MySQL root user, so go ahead and do that.

Then, run

sudo /usr/bin/mysql_secure_installation

Enter “y“.

Depending on the level of security, you’ll have the option to adjust the password complexity.
For now, we’ll be using the strong security preset.

For any following options, enter “y” and continue.

Step 3: Install PHP

Next, let’s install PHP. Execute the following command.

sudo apt-get install php -y

Then, install common PHP extensions such as GD, MySQL, and others.

sudo apt-get install -y php-{bcmath,bz2,intl,gd,mbstring,mcrypt,mysql,zip} && sudo apt-get install libapache2-mod-php -y

Step 4: Start Apache and MySQL on boot

This is necessary to start your web environment on boot.

sudo systemctl enable apache2.service
sudo systemctl enable mysql.service

Finally, restart Apache to allow PHP to run.

systemctl restart apache2.service

Additional Information

There are a set of modifications you may add to Apache.
For example, one might want to take advantage of Apache’s mod_rewrite module, which allows you to use regular expressions to change the destination URL, create “pretty” URLs, and more. This is accomplished via a2enmod, a command used by Apache to enable an add-on. To disable an add-on, use a2dismod in its place.

For mod_rewrite, you’d use this command to enable it.

sudo a2enmod rewrite

To disable it, execute this command.

sudo a2dismod rewrite

As usual, this is a configuration change, so you’ll need to restart Apache after any change.

Firewall Configuration

This is only necessary if you’ve configured your system firewall. Depending on which firewall you’ve chosen, if you have enabled ufw (also known as uncomplicated firewall), it’s as easy as running sudo ufw allow 80. If you only have iptables enabled, the command would be sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT.

Conclusion

You’ve successfully installed a LAMP stack on your Ubuntu 17.04 VPS. Happy coding!

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How to Deploy Ghost v0.11 LTS on Ubuntu 16.04

Next Post

Recovering From a Kernel Panic Using a Custom ISO

Next Post
8 Linux ‘Parted’ Commands to Create, Resize and Rescue Disk Partitions

Recovering From a Kernel Panic Using a Custom ISO

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet