Skip to content

Instantly share code, notes, and snippets.

@teja156
Last active July 7, 2024 00:17
Show Gist options
  • Save teja156/8c35a05f43635da4cbd06b47c0d91e93 to your computer and use it in GitHub Desktop.
Save teja156/8c35a05f43635da4cbd06b47c0d91e93 to your computer and use it in GitHub Desktop.
Commands for deploying wordpress website on AWS EC2 shown in my YouTube video
YouTube video link: https://youtu.be/8Uofkq718n8
All the commands that are executed in the above youtube video are mentioned in this gist.
1. Install Apache server on Ubuntu
sudo apt install apache2
2. Install php runtime and php mysql connector
sudo apt install php libapache2-mod-php php-mysql
3. Install MySQL server
sudo apt install mysql-server
4. Login to MySQL server
sudo mysql -u root
5. Change authentication plugin to mysql_native_password (change the password to something strong)
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'Testpassword@123';
6. Create a new database user for wordpress (change the password to something strong)
CREATE USER 'wp_user'@localhost IDENTIFIED BY 'Testpassword@123';
7. Create a database for wordpress
CREATE DATABASE wp;
8. Grant all privilges on the database 'wp' to the newly created user
GRANT ALL PRIVILEGES ON wp.* TO 'wp_user'@localhost;
9. Download wordpress
cd /tmp
wget https://wordpress.org/latest.tar.gz
10. Unzip
tar -xvf latest.tar.gz
11. Move wordpress folder to apache document root
sudo mv wordpress/ /var/www/html
12. Command to restart/reload apache server
sudo systemctl restart apache2
OR
sudo systemctl reload apache2
13. Install certbot
sudo apt-get update
sudo apt install certbot python3-certbot-apache
14. Request and install ssl on your site with certbot
sudo certbot --apache
@ivankiller2023
Copy link

Do you want to continue? [Y/n]
Err:1 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 apache2-bin amd64 2.4.52-1ubuntu4.6
  404  Not Found [IP: 3.110.169.167 80]
Err:2 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 apache2-data all 2.4.52-1ubuntu4.6
  404  Not Found [IP: 3.110.169.167 80]
Err:3 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 apache2-utils amd64 2.4.52-1ubuntu4.6
  404  Not Found [IP: 3.110.169.167 80]
Err:4 http://ap-south-1.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 apache2 amd64 2.4.52-1ubuntu4.6
  404  Not Found [IP: 3.110.169.167 80]
E: Failed to fetch http://ap-south-1.ec2.archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-bin_2.4.52-1ubuntu4.6_amd64.deb  404  Not Found [IP: 3.110.169.167 80]
E: Failed to fetch http://ap-south-1.ec2.archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-data_2.4.52-1ubuntu4.6_all.deb  404  Not Found [IP: 3.110.169.167 80]
E: Failed to fetch http://ap-south-1.ec2.archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-utils_2.4.52-1ubuntu4.6_amd64.deb  404  Not Found [IP: 3.110.169.167 80]
E: Failed to fetch http://ap-south-1.ec2.archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2_2.4.52-1ubuntu4.6_amd64.deb  404  Not Found [IP: 3.110.169.167 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

What to do?

@princesokrati
Copy link

if you open any blog then it is not working may by htaccess issue i have that same folder name wordpress can any one help ?

@Sailendrakafle
Copy link

I got this while accessing WordPress:

@LoveAboveAll
Copy link

I follow every step but I get this message after trying to install mysql
Uploading Screenshot (23).png…

@LoveAboveAll
Copy link

  1. I follow every step but I get this message after trying to install mysql. Somebody help what I'm doing wrong

ubuntu@ip-172-31-13-249:$ sudo apt install mysql-server
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libcgi-fast-perl libcgi-pm-perl libclone-perl libencode-locale-perl
libevent-pthreads-2.1-7 libfcgi-bin libfcgi-perl libfcgi0ldbl
libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl
libhttp-date-perl libhttp-message-perl libio-html-perl
liblwp-mediatypes-perl libmecab2 libprotobuf-lite23 libtimedate-perl
liburi-perl mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-8.0
mysql-client-core-8.0 mysql-common mysql-server-8.0 mysql-server-core-8.0
Suggested packages:
libdata-dump-perl libipc-sharedcache-perl libbusiness-isbn-perl libwww-perl
mailx tinyca
The following NEW packages will be installed:
libcgi-fast-perl libcgi-pm-perl libclone-perl libencode-locale-perl
libevent-pthreads-2.1-7 libfcgi-bin libfcgi-perl libfcgi0ldbl
libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl
libhttp-date-perl libhttp-message-perl libio-html-perl
liblwp-mediatypes-perl libmecab2 libprotobuf-lite23 libtimedate-perl
liburi-perl mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-8.0
mysql-client-core-8.0 mysql-common mysql-server mysql-server-8.0
mysql-server-core-8.0
0 upgraded, 28 newly installed, 0 to remove and 0 not upgraded.
Need to get 21.8 MB/29.6 MB of archives.
After this operation, 243 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Ign:1 http://us-east-2.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 mysql-client-core-8.0 amd64 8.0.35-0ubuntu0.22.04.1
Ign:2 http://us-east-2.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 mysql-client-8.0 amd64 8.0.35-0ubuntu0.22.04.1
Ign:3 http://us-east-2.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 mysql-server-core-8.0 amd64 8.0.35-0ubuntu0.22.04.1
Ign:4 http://us-east-2.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 mysql-server-8.0 amd64 8.0.35-0ubuntu0.22.04.1
Ign:5 http://us-east-2.ec2.archive.ubuntu.com/ubuntu jammy-updates/main amd64 mysql-server all 8.0.35-0ubuntu0.22.04.1
Err:1 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 mysql-client-core-8.0 amd64 8.0.35-0ubuntu0.22.04.1
404 Not Found [IP: 52.15.107.13 80]
Err:2 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 mysql-client-8.0 amd64 8.0.35-0ubuntu0.22.04.1
404 Not Found [IP: 52.15.107.13 80]
Err:3 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 mysql-server-core-8.0 amd64 8.0.35-0ubuntu0.22.04.1
404 Not Found [IP: 52.15.107.13 80]
Err:4 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 mysql-server-8.0 amd64 8.0.35-0ubuntu0.22.04.1
404 Not Found [IP: 52.15.107.13 80]
Err:5 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 mysql-server all 8.0.35-0ubuntu0.22.04.1
404 Not Found [IP: 52.15.107.13 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/mysql-client-core-8.0_8.0.35-0ubuntu0.22.04.1_amd64.deb 404 Not Found [IP: 52.15.107.13 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/mysql-client-8.0_8.0.35-0ubuntu0.22.04.1_amd64.deb 404 Not Found [IP: 52.15.107.13 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/mysql-server-core-8.0_8.0.35-0ubuntu0.22.04.1_amd64.deb 404 Not Found [IP: 52.15.107.13 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/mysql-server-8.0_8.0.35-0ubuntu0.22.04.1_amd64.deb 404 Not Found [IP: 52.15.107.13 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/mysql-server_8.0.35-0ubuntu0.22.04.1_all.deb 404 Not Found [IP: 52.15.107.13 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
ubuntu@ip-172-31-13-249:
$

@Novavamp
Copy link

Novavamp commented Feb 20, 2024

If you have any issues regarding permalinks and pages showing error not found. Goto this path: /etc/apache2/sites-enabled and sudo nano 000-default.conf then add this code:

<Directory path/to/dir>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</ Directory>

(the closing without space)
Then restart apache2 sudo systemctl restart apache2

@Syamabbas
Copy link

Syamabbas commented Mar 11, 2024

I follow every step and get succedd, thx for it

@Rolkany
Copy link

Rolkany commented Apr 30, 2024

I Have a problem:

@shahryar-cmyk
Copy link

If you have any issues regarding permalinks and pages showing error not found. Goto this path: /etc/apache2/sites-enabled and sudo nano 000-default.conf then add this code:

<Directory path/to/dir> Options Indexes FollowSymLinks AllowOverride All Require all granted </ Directory>

(the closing without space) Then restart apache2 sudo systemctl restart apache2

I tried this but the issue remains same.
image

@Novavamp
Copy link

Novavamp commented May 2, 2024

If you have any issues regarding permalinks and pages showing error not found. Goto this path: /etc/apache2/sites-enabled and sudo nano 000-default.conf then add this code:
<Directory path/to/dir> Options Indexes FollowSymLinks AllowOverride All Require all granted </ Directory>
(the closing without space) Then restart apache2 sudo systemctl restart apache2

I tried this but the issue remains same. image

Make sure you added the correct path to your website directory here: <Directory path/to/dir>

And remove the space at the closing tag (I added space so that GitHub doesn't change the output of the code).

@hayairfan
Copy link

hayairfan commented May 14, 2024

In the last part of the video, to request the SSL certificate for the domain, certbot failed to authenticate the domain. Can anyone help me?

Thanks

@teja156

@samaybhingradiya
Copy link

If I close MobaXterm, my website can't be reached. So, is there any another way, or i am missing out something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment