This post is to show the steps I followed to install LAMP(Linux, Apache, MySQL, PHP) Stack in the server and how I installed WordPress and fixing the permalink for pages.
Requirements : A dedicated Ubuntu/Linux server
- Install Apache Web Server :
apt install apache2
Now check socket status (cmd:ss) or ensure apache server is running, by entering the IP address of your server in any browser address bar - Install and Configure Certbot [SSL]
- Search and install certbot and required packages
apt install certbotapt install python3-certbot-apache
- Run Certbot for configuration
certbot --apache- Need to provide email id for communication and our domain name when required
- Search and install certbot and required packages
- Validate SSL Certificate by reloading the website
- Install php-mysql
apt install php-mysql- And required packages libapache2-mod-php7.4 [If needed]
- Run the following commands to enable
a2enmod php7.4a2enmod rewrite
- Install MariaDB (mariadb-server and mariadb-client)
apt install mariadb-serverapt install mariadb-client- mysql -u root -p (to config our db)
ref – https://wordpress.org/support/article/creating-database-for-wordpress/#using-the-mysql-client
Create WordPress Database:CREATE DATABASE databasename;GRANT ALL PRIVILEGES ON databasename.* TO wordpressusername"@"hostname" IDENTIFIED BY "password";FLUSH PRIVILEGES;EXIT
- Download and Extract WordPress
ref – https://wordpress.org/support/article/how-to-install-wordpress/#detailed-instructions- Download
wget https://wordpress.org/latest.tar.gz - Extract
tar -xzvf latest.tar.gz - Move this extracted folder
mv -f wordpress /var/www/html/ - Update the defualt document root path in apache2 config file (use nano)
Path – /etc/apache2/sites-enabled/000-default-le-ssl.conf- Update DocumentRoot to /var/www/html/wordpress
- Give access to WordPress Folder
chown www-data: wordpress -R - Reload apache2 server
systemctl reload apache2
- Download
- Now Reload site to start WordPress setup
- WordPress
- Note down the Database name, username, password, host, Table details for reference
- Provide user name, password and website title and complete the setup
- Login to Wordress, so we can access wp-admin (Dashboard)
- If login page closed / missed during the setup flow
- We can add /wp-admin or /wp-login.php at the end domain/url
- Navigate through setting and configure basic settings and customize the website
- Fixing Permalink
- Visit Settings – permalink from the Dashboard
- Change it to post name and Save
- Visit website and check if the default blog is opening
- For Permalink changes tyo work we need to override the web directory rule to AllowOverride
- Change your web directory (/var/www/) override rule in
/etc/apache2/apache2.conf - Change AllowOverride None to
AllowOverride All - Restart apache2 server
- Change your web directory (/var/www/) override rule in
- Now Reload the website and visit the the default blog
