install wordpress

apt update

apt install apache2

ufw enable

ufw allow apache

apt install openssh-server

ufw allow ssh


apt install php php-zip php-json php-mbstring php-mysql 


wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.zip 

unzip phpMyAdmin-5.2.0-all-languages.zip 

mv phpMyAdmin-5.2.0-all-languages /usr/share/phpmyadmin 


mkdir /usr/share/phpmyadmin/tmp 

chown -R www-data:www-data /usr/share/phpmyadmin 

chmod 777 /usr/share/phpmyadmin/tmp 



nano /etc/apache2/conf-available/phpmyadmin.conf 


isinya :

Alias /phpmyadmin /usr/share/phpmyadmin

Alias /phpMyAdmin /usr/share/phpmyadmin

 

<Directory /usr/share/phpmyadmin/>

   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>

      <RequireAny>

      Require all granted

     </RequireAny>

   </IfModule>

</Directory>

 

<Directory /usr/share/phpmyadmin/setup/>

   <IfModule mod_authz_core.c>

     <RequireAny>

       Require all granted

     </RequireAny>

   </IfModule>

</Directory>

=====================


sudo a2enconf phpmyadmin 

sudo systemctl restart apache2 



http://your-server-ip-domain/phpmyadmin



password mysql ???

apt install mysql-server

sudo mysql -u root

mysql> flush privileges;

mysql> USE mysql

mysql> ALTER USER  'root'@'localhost' IDENTIFIED BY 'pengentausaja';


opsi "dangerous"

mysql> ALTER USER  'root'@'%' IDENTIFIED BY 'pengentausaja';


atau buat user lain :


mysql>CREATE USER 'azila'@'%' IDENTIFIED BY 'pengentausaja@@@@@';


mysql>grant all privileges on *.* to 'azila'@'%' with grant option;


install wordpress


cd /var/www/html

wget https://wordpress.org/latest.zip

unzip latest.zip

cd wordpress

mv * ../


copykan ke /html semuanya


browser :

ketik alamat web (instalasi wordpress)

alamatweb/phpmyadmin

buat database


selesai.


user dimas

password: dimasuinjakarta@

install phpmyadmin versi 2 -

phpMyadmin is the best web based client for accessing MySQL servers. It is freely available to download and install on your server. You can host this on any server running with Apache and PHP.

The phpMyAdmin is written on PHP. The current phpMyAdmin version is compatible with PHP 7.1 and newer and MySQL 5.5 or MariaDB 5.5 or newer.

This tutorial will help you to install and configure phpMyAdmin on Ubuntu 20.04 Linux system.

Step 1 – Install Apache and PHP

We are assuming you already have installed the MySQL server on Ubuntu system. So just install the other required packages to run and access phpMyAdmin.

ADVERTISEMENT

sudo apt install apache2 wget unzip 
sudo apt install php php-zip php-json php-mbstring php-mysql 

Once the installation finished, enable and start Apache web server.

sudo systemctl enable apache2 
sudo systemctl start apache2 

Step 2 – Install phpMyAdmin on Ubuntu 20.04

phpMyAdmin is also available under the default packages repository but mostly they have older version. In this tutorial, we will download latest phpMyAdmin and configure on our system.

ADVERTISEMENT

Your system is ready for the phpMyAdmin installation. Download the latest phpMyAdmin archive from the official download page, or use the below commands to download phpMyAdmin 5.1.1 on your system.

After downloading extract archive and move to the proper location.

wget https://files.phpmyadmin.net/phpMyAdmin/5.1.1/phpMyAdmin-5.1.1-all-languages.zip    (sepertinya gak support php versi 7) coba ini 
wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.zip 
unzip phpMyAdmin-5.1.1-all-languages.zip 
mv phpMyAdmin-5.1.1-all-languages /usr/share/phpmyadmin 

Next, create tmp directory and set the proper permissions.

ADVERTISEMENT

mkdir /usr/share/phpmyadmin/tmp 
chown -R www-data:www-data /usr/share/phpmyadmin 
chmod 777 /usr/share/phpmyadmin/tmp 

Step 3 – Configure phpMyAdmin

Now, you need to configure web server to serve phpMyAdmin on network. Create Apache configuration file for phpMyAdmin and edit in text editor:

sudo vi /etc/apache2/conf-available/phpmyadmin.conf 

add the below content to file.

Save your file. Press ESC key to switch to command more. Then type : (colon) and type w after the colon and hit Enter.

After making all the changes, make sure to start the Apache service to reload all settings.

sudo a2enconf phpmyadmin 
sudo systemctl restart apache2 

Step 4 – Adjusting FirewallD

The systems with enabled firewalls need to allow HTTP service from the firewall. Run the below commands to open a port for the webserver in the firewall.

sudo firewall-cmd --permanent --add-service=http 
sudo firewall-cmd --reload 

Step 5 – Access phpMyAdmin

All done. You have finished the setup with the phpMyAdmin on Ubuntu Linux system. Now access phpMyAdmin with the server IP address or domain name.

http://your-server-ip-domain/phpmyadmin

Replace your-server-ip-domain with the localhost (for the local machines), or system IP address for remote machines. I have updated our DNS and pointed dbhost.tecadmin.net to the server’s IP address.

how to install phpmyadmin on ubuntu 20.04

Log in with the username and password used to access MySQL on the command line.

setup phpmyadmin ubuntu 20.04

Conclusion

You have successfully configured phpMyAdmin on Ubuntu system. Let’s disable root user login for the phpMyAdmin for security purposes.


tambah user ke group root

 

Adding User to the sudo Group

On Ubuntu, the easiest way to grant sudo privileges to a user is by adding the user to the “sudo” group. Members of this group can execute any command as root via sudo and prompted to authenticate themselves with their password when using sudo.

We’re assuming that the user already exists. If you want to create a new user, check this guide.

To add the user to the group run the command below as root or another sudo user. Make sure you change “username” with the name of the user that you want to grant permissions to.

usermod -aG sudo username

Granting sudo access using this method is sufficient for most use cases.

To ensure that the user has sudo privileges, run the whoami command:

sudo whoami

You will be prompted to enter the password. If the user has sudo access, the command will print “root”:

root

If you get an error saying “user is not in the sudoers file”, it means that the user doesn’t have sudo privileges.

How To Install the Apache Web Server on Ubuntu 20.04

 

Step 1 — Installing Apache

Apache is available within Ubuntu’s default software repositories, making it possible to install it using conventional package management tools.

Let’s begin by updating the local package index to reflect the latest upstream changes:

  1. sudo apt update

Then, install the apache2 package:

  1. sudo apt install apache2

After confirming the installation, apt will install Apache and all required dependencies.

Step 2 — Adjusting the Firewall

Before testing Apache, it’s necessary to modify the firewall settings to allow outside access to the default web ports. Assuming that you followed the instructions in the prerequisites, you should have a UFW firewall configured to restrict access to your server.

During installation, Apache registers itself with UFW to provide a few application profiles that can be used to enable or disable access to Apache through the firewall.

List the ufw application profiles by typing:

  1. sudo ufw app list

You will receive a list of the application profiles:

Output
Available applications: Apache Apache Full Apache Secure OpenSSH

As indicated by the output, there are three profiles available for Apache:

  • Apache: This profile opens only port 80 (normal, unencrypted web traffic)
  • Apache Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)
  • Apache Secure: This profile opens only port 443 (TLS/SSL encrypted traffic)

It is recommended that you enable the most restrictive profile that will still allow the traffic you’ve configured. Since we haven’t configured SSL for our server yet in this guide, we will only need to allow traffic on port 80:

  1. sudo ufw allow 'Apache'

You can verify the change by typing:

  1. sudo ufw status
  2. sudo ufw enable

The output will provide a list of allowed HTTP traffic:

Output
Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere Apache ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) Apache (v6) ALLOW Anywhere (v6)

As indicated by the output, the profile has been activated to allow access to the Apache web server.

Step 3 — Checking your Web Server

At the end of the installation process, Ubuntu 20.04 starts Apache. The web server should already be up and running.

Check with the systemd init system to make sure the service is running by typing:

  1. sudo systemctl status apache2
Output
● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2020-04-23 22:36:30 UTC; 20h ago Docs: https://httpd.apache.org/docs/2.4/ Main PID: 29435 (apache2) Tasks: 55 (limit: 1137) Memory: 8.0M CGroup: /system.slice/apache2.service ├─29435 /usr/sbin/apache2 -k start ├─29437 /usr/sbin/apache2 -k start └─29438 /usr/sbin/apache2 -k start

As confirmed by this output, the service has started successfully. However, the best way to test this is to request a page from Apache.

You can access the default Apache landing page to confirm that the software is running properly through your IP address. If you do not know your server’s IP address, you can get it a few different ways from the command line.

Try typing this at your server’s command prompt:

  1. hostname -I

You will get back a few addresses separated by spaces. You can try each in your web browser to determine if they work.

Another option is to use the Icanhazip tool, which should give you your public IP address as read from another location on the internet:

  1. curl -4 icanhazip.com

When you have your server’s IP address, enter it into your browser’s address bar:

http://your_server_ip

You should see the default Ubuntu 20.04 Apache web page:

Apache default page

This page indicates that Apache is working correctly. It also includes some basic information about important Apache files and directory locations.

Step 4 — Managing the Apache Process

Now that you have your web server up and running, let’s go over some basic management commands using systemctl.

To stop your web server, type:

  1. sudo systemctl stop apache2

To start the web server when it is stopped, type:

  1. sudo systemctl start apache2

To stop and then start the service again, type:

  1. sudo systemctl restart apache2

If you are simply making configuration changes, Apache can often reload without dropping connections. To do this, use this command:

  1. sudo systemctl reload apache2

By default, Apache is configured to start automatically when the server boots. If this is not what you want, disable this behavior by typing:

  1. sudo systemctl disable apache2

To re-enable the service to start up at boot, type:

  1. sudo systemctl enable apache2

Apache should now start automatically when the server boots again.

When using the Apache web server, you can use virtual hosts (similar to server blocks in Nginx) to encapsulate configuration details and host more than one domain from a single server. We will set up a domain called your_domain, but you should replace this with your own domain name. If you are setting up a domain name with DigitalOcean, please refer to our Networking Documentation.

Apache on Ubuntu 20.04 has one server block enabled by default that is configured to serve documents from the /var/www/html directory. While this works well for a single site, it can become unwieldy if you are hosting multiple sites. Instead of modifying /var/www/html, let’s create a directory structure within /var/www for a your_domain site, leaving /var/www/html in place as the default directory to be served if a client request doesn’t match any other sites.

Create the directory for your_domain as follows:

  1. sudo mkdir /var/www/your_domain

Next, assign ownership of the directory with the $USER environment variable:

  1. sudo chown -R $USER:$USER /var/www/your_domain

The permissions of your web roots should be correct if you haven’t modified your umask value, which sets default file permissions. To ensure that your permissions are correct and allow the owner to read, write, and execute the files while granting only read and execute permissions to groups and others, you can input the following command:

  1. sudo chmod -R 755 /var/www/your_domain

Next, create a sample index.html page using nano or your favorite editor:

  1. sudo nano /var/www/your_domain/index.html

Inside, add the following sample HTML:

/var/www/your_domain/index.html
<html>
    <head>
        <title>Welcome to Your_domain!</title>
    </head>
    <body>
        <h1>Success!  The your_domain virtual host is working!</h1>
    </body>
</html>

Save and close the file when you are finished.

In order for Apache to serve this content, it’s necessary to create a virtual host file with the correct directives. Instead of modifying the default configuration file located at /etc/apache2/sites-available/000-default.conf directly, let’s make a new one at /etc/apache2/sites-available/your_domain.conf:

  1. sudo nano /etc/apache2/sites-available/your_domain.conf

Paste in the following configuration block, which is similar to the default, but updated for our new directory and domain name:

/etc/apache2/sites-available/your_domain.conf
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName your_domain
    ServerAlias www.your_domain
    DocumentRoot /var/www/your_domain
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Notice that we’ve updated the DocumentRoot to our new directory and ServerAdmin to an email that the your_domain site administrator can access. We’ve also added two directives: ServerName, which establishes the base domain that should match for this virtual host definition, and ServerAlias, which defines further names that should match as if they were the base name.

Save and close the file when you are finished.

Let’s enable the file with the a2ensite tool:

  1. sudo a2ensite your_domain.conf

Disable the default site defined in 000-default.conf:

  1. sudo a2dissite 000-default.conf

Next, let’s test for configuration errors:

  1. sudo apache2ctl configtest

You should receive the following output:

Output
Syntax OK

Restart Apache to implement your changes:

  1. sudo systemctl restart apache2

Apache should now be serving your domain name. You can test this by navigating to http://your_domain, where you should see something like this:

Apache virtual host example

Step 6 – Getting Familiar with Important Apache Files and Directories

Now that you know how to manage the Apache service itself, you should take a few minutes to familiarize yourself with a few important directories and files.

Content

  • /var/www/html: The actual web content, which by default only consists of the default Apache page you saw earlier, is served out of the /var/www/html directory. This can be changed by altering Apache configuration files.

Server Configuration

  • /etc/apache2: The Apache configuration directory. All of the Apache configuration files reside here.
  • /etc/apache2/apache2.conf: The main Apache configuration file. This can be modified to make changes to the Apache global configuration. This file is responsible for loading many of the other files in the configuration directory.
  • /etc/apache2/ports.conf: This file specifies the ports that Apache will listen on. By default, Apache listens on port 80 and additionally listens on port 443 when a module providing SSL capabilities is enabled.
  • /etc/apache2/sites-available/: The directory where per-site virtual hosts can be stored. Apache will not use the configuration files found in this directory unless they are linked to the sites-enabled directory. Typically, all server block configuration is done in this directory, and then enabled by linking to the other directory with the a2ensite command.
  • /etc/apache2/sites-enabled/: The directory where enabled per-site virtual hosts are stored. Typically, these are created by linking to configuration files found in the sites-available directory with the a2ensite. Apache reads the configuration files and links found in this directory when it starts or reloads to compile a complete configuration.
  • /etc/apache2/conf-available/, /etc/apache2/conf-enabled/: These directories have the same relationship as the sites-available and sites-enabled directories, but are used to store configuration fragments that do not belong in a virtual host. Files in the conf-available directory can be enabled with the a2enconf command and disabled with the a2disconf command.
  • /etc/apache2/mods-available/, /etc/apache2/mods-enabled/: These directories contain the available and enabled modules, respectively. Files ending in .load contain fragments to load specific modules, while files ending in .conf contain the configuration for those modules. Modules can be enabled and disabled using the a2enmod and a2dismod command.

Server Logs

  • /var/log/apache2/access.log: By default, every request to your web server is recorded in this log file unless Apache is configured to do otherwise.
  • /var/log/apache2/error.log: By default, all errors are recorded in this file. The LogLevel directive in the Apache configuration specifies how much detail the error logs will contain.