{"id":5644,"date":"2020-04-30T22:29:53","date_gmt":"2020-04-30T19:29:53","guid":{"rendered":"https:\/\/kifarunix.com\/?p=5644"},"modified":"2024-03-14T20:01:27","modified_gmt":"2024-03-14T17:01:27","slug":"install-latest-wordpress-with-lamp-stack-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-latest-wordpress-with-lamp-stack-on-ubuntu-20-04\/","title":{"rendered":"Install latest WordPress with LAMP Stack on Ubuntu 20.04"},"content":{"rendered":"\n
Welcome to our guide on how to install latest WordPress with LAMP Stack on Ubuntu 20.04. As may already know, WordPress<\/a> is a free and open-source content management system written in PHP and is mostly used to create free websites or build personal blogs.<\/p>\n\n\n\n Are you using WordPress and looking for a professional WordPress website builder? Look no further since Elementor can help you create beautiful pages<\/a>.<\/p>\n\n\n\n Before you can install WordPress on Ubuntu 20.04, there are a few prerequisites that must be set in place before you can proceed.<\/p>\n\n\n\n Ensure that your system packages are up-to-date.<\/p>\n\n\n\n WordPress is a PHP based application and thus, it requires a LAMP or LEMP stack installed to function properly. In this demo, we run WordPress with LAMP stack; Ubuntu 20.04 as the Linux OS, PHP 7.4, MySQL 8, and Apache as the web server.<\/p>\n\n\n\n Follow the link below to install LAMP Stack on Ubuntu 20.04;<\/p>\n\n\n\n Install LAMP Stack on Ubuntu 20.04<\/a><\/p>\n\n\n\n Next, install other required PHP modules if not already installed;<\/p>\n\n\n\n Login to MySQL and create WordPress database;<\/p>\n\n\n\n Create a WordPress database. Replace the database and database user accordingly.<\/p>\n\n\n\n Create a WordPress database user and grant all privileges on the database.<\/p>\n\n\n\n Reload the database privileges tables and exit the database.<\/p>\n\n\n\n WordPress 5.4.1 is the latest version of the writing of this guide. Download the latest version WordPress archive from the WordPress downloads page<\/a>.<\/p>\n\n\n\n Create your web root directory where to install WordPress. Replace the names accordingly.<\/p>\n\n\n\n Next, extract WordPress archive contents to your Web root directory created above.<\/p>\n\n\n\n Verify that the WordPress files are in place.<\/p>\n\n\n\n WordPress comes with a sample configuration, Next, edit the configuration file and set the database connection details,<\/p>\n\n\n\n Replace the DB_NAME, DB_USER, DB_PASSWORD<\/strong> with the values you set while creating the MySQL database for WordPress.<\/p>\n\n\n\n Next, generate authentication unique keys and salts. You can simply generate the keys and salts from WordPress Secret-Key service as follows;<\/p>\n\n\n\n Note, Do not use the above keys. Generate yours, \ud83d\ude42<\/p>\n\n\n\n Within the wp-config.php<\/strong>, replace the following lines with the above.<\/p>\n\n\n\n Your configuration should look like;<\/p>\n\n\n\n Save and exit the configuration file.<\/p>\n\n\n\n Create an Apache virtual host configuration for your WordPress site.<\/p>\n\n\n\n Save and exit the config file.<\/p>\n\n\n\n Set the user and group ownership of your site configuration to Apache user, Check Apache syntac errors;<\/p>\n\n\n\n If you get, Disable the default Apache site;<\/p>\n\n\n\n Restart Apache;<\/p>\n\n\n\n If UFW is running, open port 80\/tcp to allow external access.<\/p>\n\n\n\n To complete setting up WordPress on Ubuntu 20.04, navigate to the browser and access your WordPress site, Choose your WordPress installation language and click Continue<\/strong>.<\/p>\n\n\n Setup your site title, your username, password, email address, choose whether to disable or enable site indexing and install WordPress on Ubuntu 20.04.<\/p>\n\n\n Once the installation is done, login to your WordPress using the username and password you just created. And there you go. Your WordPress is setup successfully.<\/p>\n\n\n\n You can now write and publish your stuff on your WordPress blog. That brings us to the end of our guide.<\/p>\n\n\n\n Install phpMyAdmin on Ubuntu 20.04<\/a><\/p>\n\n\n\n How to fix WordPress could not establish a secure connection to WordPress.org<\/a><\/p>\n\n\n\n Install WordPress with Nginx and MySQL 8 on CentOS 8<\/a><\/p>\n\n\n\nInstalling WordPress with LAMP Stack on Ubuntu 20.04<\/h2>\n\n\n\n
Prerequsites<\/h3>\n\n\n\n
Run System update<\/h4>\n\n\n\n
apt update\napt upgrade<\/code><\/pre>\n\n\n\n
Install LAMP\/LEMP Stack<\/h4>\n\n\n\n
apt install php7.4-{mysql,cli,json,opcache,xml,gd,curl}<\/code><\/pre>\n\n\n\n
Create WordPress MySQL Database<\/h4>\n\n\n\n
mysql -u root -p<\/code><\/pre>\n\n\n\n
create database wpdb;<\/code><\/pre>\n\n\n\n
create user wpadmin@localhost identified by 'StrongP@33#';<\/code><\/pre>\n\n\n\n
grant all on wpdb.* to wpadmin@localhost;<\/code><\/pre>\n\n\n\n
flush privileges;<\/code><\/pre>\n\n\n\n
quit<\/code><\/pre>\n\n\n\n
Install WordPress (5.x)<\/h3>\n\n\n\n
wget https:\/\/wordpress.org\/latest.tar.gz<\/code><\/pre>\n\n\n\n
mkdir \/var\/www\/html\/wp.kifarunix-demo.com<\/code><\/pre>\n\n\n\n
tar xzf latest.tar.gz -C \/var\/www\/html\/wp.kifarunix-demo.com --strip-components=1<\/code><\/pre>\n\n\n\n
ls \/var\/www\/html\/wp.kifarunix-demo.com<\/code><\/pre>\n\n\n\n
index.php wp-activate.php wp-comments-post.php wp-cron.php wp-load.php wp-settings.php xmlrpc.php\nlicense.txt wp-admin wp-config-sample.php wp-includes wp-login.php wp-signup.php\nreadme.html wp-blog-header.php wp-content wp-links-opml.php wp-mail.php wp-trackback.php<\/code><\/pre>\n\n\n\n
Configure WordPress on Ubuntu 20.04<\/h3>\n\n\n\n
wp-config-sample.php<\/code>. Rename the sample configuration file.<\/p>\n\n\n\n
cp \/var\/www\/html\/wp.kifarunix-demo.com\/wp-config{-sample,}.php<\/code><\/pre>\n\n\n\n
vim \/var\/www\/html\/wp.kifarunix-demo.com\/wp-config.php<\/code><\/pre>\n\n\n\n
...\n\/\/ ** MySQL settings - You can get this info from your web host ** \/\/\n\/** The name of the database for WordPress *\/\ndefine( 'DB_NAME', 'wpdb<\/strong>' );\n\n\/** MySQL database username *\/\ndefine( 'DB_USER', 'wpadmin<\/strong>' );\n\n\/** MySQL database password *\/\ndefine( 'DB_PASSWORD', 'StrongP@33#<\/strong>' );\n\n\/** MySQL hostname *\/\ndefine( 'DB_HOST', 'localhost' );\n\n\/** Database Charset to use in creating database tables. *\/\ndefine( 'DB_CHARSET', 'utf8' );\n...<\/code><\/pre>\n\n\n\n
curl -s https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/<\/code><\/pre>\n\n\n\n
define('AUTH_KEY', 'BkIM1nZ`;ni.E(^HO@,R{bG%7oq@iwI=~=-];h%|bA{idi ^BTT|[7,l_L&i5UY');\ndefine('SECURE_AUTH_KEY', 'WAgvv#q|d_EOhWk|;kKhE2&jO{h-G#oMz4,W;O)xH}VB63a2FV^*?oR$5w[tP0=h');\ndefine('LOGGED_IN_KEY', '?|&6H,|v3}-_-(m[*m Kd<|3|m3QMLW5|>Tr=[I|b9q)! g*=H9vD<O6fqe>pg(@');\ndefine('NONCE_KEY', '&yq9[1N^f,P l IVMse<?QXJb+W3ImG@1,yFkP!fE;<Q296_vEs t%ZVdT.f&j:9');\ndefine('AUTH_SALT', '-pE?xU-<w-|Y7S~<Bm+HXCVr$b~$vt]KLNd|Za-__]Io#,,gN4y6l.H|$r=6amZ!');\ndefine('SECURE_AUTH_SALT', '+V(D|4%|d$J!D|McEDFOl=x*YTtha4We;=HjkRzHz#(0(YZPIK,!0vI9e{ZBV\/=]');\ndefine('LOGGED_IN_SALT', 'hLc|}}b8YjjaRawp={[)},xZkwX%Uun_<>_|+r[uD-?sbJQp|_e0?eXxtP~|$#8E');\ndefine('NONCE_SALT', 'x!Tc@i|+Hg;-w++_l;>-NL>+xB&r{FfQ*@E|ti\/TAV-THER@UFapaUS7ejboTCi]');<\/code><\/pre>\n\n\n\n
...\n * @since 2.6.0\n *\/\ndefine( 'AUTH_KEY', 'put your unique phrase here' );\ndefine( 'SECURE_AUTH_KEY', 'put your unique phrase here' );\ndefine( 'LOGGED_IN_KEY', 'put your unique phrase here' );\ndefine( 'NONCE_KEY', 'put your unique phrase here' );\ndefine( 'AUTH_SALT', 'put your unique phrase here' );\ndefine( 'SECURE_AUTH_SALT', 'put your unique phrase here' );\ndefine( 'LOGGED_IN_SALT', 'put your unique phrase here' );\ndefine( 'NONCE_SALT', 'put your unique phrase here' );\n\n\/**#@-*\/\n...<\/code><\/pre>\n\n\n\n
...\n * @since 2.6.0\n *\/\n\/**\n * define( 'AUTH_KEY', 'put your unique phrase here' );\n * define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );\n * define( 'LOGGED_IN_KEY', 'put your unique phrase here' );\n * define( 'NONCE_KEY', 'put your unique phrase here' );\n * define( 'AUTH_SALT', 'put your unique phrase here' );\n * define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );\n * define( 'LOGGED_IN_SALT', 'put your unique phrase here' );\n * define( 'NONCE_SALT', 'put your unique phrase here' );\n *\/\ndefine('AUTH_KEY', 'BkIM1nZ`;ni.E(^HO@,R{bG%7oq@iwI=~=-];h%|bA{idi ^BTT|[7,l_L&i5UY');\ndefine('SECURE_AUTH_KEY', 'WAgvv#q|d_EOhWk|;kKhE2&jO{h-G#oMz4,W;O)xH}VB63a2FV^*?oR$5w[tP0=h');\ndefine('LOGGED_IN_KEY', '?|&6H,|v3}-_-(m[*m Kd<|3|m3QMLW5|>Tr=[I|b9q)! g*=H9vD<O6fqe>pg(@');\ndefine('NONCE_KEY', '&yq9[1N^f,P l IVMse<?QXJb+W3ImG@1,yFkP!fE;<Q296_vEs t%ZVdT.f&j:9');\ndefine('AUTH_SALT', '-pE?xU-<w-|Y7S~<Bm+HXCVr$b~$vt]KLNd|Za-__]Io#,,gN4y6l.H|$r=6amZ!');\ndefine('SECURE_AUTH_SALT', '+V(D|4%|d$J!D|McEDFOl=x*YTtha4We;=HjkRzHz#(0(YZPIK,!0vI9e{ZBV\/=]');\ndefine('LOGGED_IN_SALT', 'hLc|}}b8YjjaRawp={[)},xZkwX%Uun_<>_|+r[uD-?sbJQp|_e0?eXxtP~|$#8E');\ndefine('NONCE_SALT', 'x!Tc@i|+Hg;-w++_l;>-NL>+xB&r{FfQ*@E|ti\/TAV-THER@UFapaUS7ejboTCi]');\n\/**#@-*\/\n...<\/code><\/pre>\n\n\n\n
Configure Apache Web Server<\/h3>\n\n\n\n
vim \/etc\/apache2\/sites-available\/wordpress.conf<\/code><\/pre>\n\n\n\n
<VirtualHost *:80>\n ServerAdmin webmaster@kifarunix-demo.com\n ServerName wp.kifarunix-demo.com\n DocumentRoot \/var\/www\/html\/wp.kifarunix-demo.com\n \n <Directory \/var\/www\/html\/wp.kifarunix-demo.com>\n AllowOverride All\n <\/Directory>\n\n ErrorLog \/var\/log\/apache2\/wp.error.log\n CustomLog \/var\/log\/apache2\/wp.access.log combined\n<\/VirtualHost><\/code><\/pre>\n\n\n\n
www-data<\/code>.<\/p>\n\n\n\n
chown -R www-data:www-data \/var\/www\/html\/wp.kifarunix-demo.com<\/code><\/pre>\n\n\n\n
apachectl -t<\/code><\/pre>\n\n\n\n
Syntax OK<\/strong><\/code>, proceed to enable WordPress site configuration.<\/p>\n\n\n\n
a2ensite wordpress.conf<\/code><\/pre>\n\n\n\n
a2dissite 000-default.conf<\/code><\/pre>\n\n\n\n
systemctl restart apache2<\/code><\/pre>\n\n\n\n
ufw allow 80\/tcp<\/code><\/pre>\n\n\n\n
Finalize WordPress Setup on Ubuntu 20.04<\/h3>\n\n\n\n
http:\/\/<server-IP-Or-hostname><\/code><\/strong>.<\/p>\n\n\n\n
<\/figure><\/div>\n\n\n
<\/figure><\/div>\n\n\n
<\/figure>\n\n\n\n
Related Tutorials<\/h3>\n\n\n\n