WordPress is a CMS (content management system) written in the PHP programming language. It is a free open source web application which includes powerful features. WordPress is considered by most to be the best content management system in the world, where you can create a beautiful websites with a simple admin panel.
In order for WordPress to work it needs a LAMP (Linux, Apache, MySQL, PhP) Stack in order to serve a working website from your VPS.
In this How-To article, we will explain How to Install WordPress with LAMP on Ubuntu in 4 quick steps.
Before you begin, you will need:
An Ubuntu VPS or Environment with Root Access
First, login to your system as root using either the SSH Console on your SkySilk VPS Dashboard or a third-party console such as PuTTY.
Your default username is always root and your password is the one set by you when you created the machine.
If you need additional help gaining access to your VPS, see the following FAQ:
Update your system:
sudo apt update && sudo apt upgrade -y
A LAMP Stack is required to run WordPress because WordPress is written using PHP and uses MySQL for the database management system.
First, install our basic LAMP Stack prerequisites:
sudo apt install apache2 mariadb-server software-properties-common
Update the repository again and add our PHP dependencies:
sudo add-apt-repositophp-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip ry ppa:ondrej/php sudo apt update sudo apt install php8.0 libapache2-mod-php8.0 php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
Wait for the package to finish installation.
Now, remove the index.html file in order to operate the HTTP server:
rm /var/www/html/index.html
systemctl restart apache2
Now it’s time to download WordPress and extract it to a web directory. First, locate where you want to install WordPress:
cd /var/www/html
Next, download WordPress by running this command:
wget https://wordpress.org/latest.tar.gz
After, extract files:
tar -xzvf latest.tar.gz
Extracted files will go to a new directory called WordPress. Move them to default web directory:
sudo rsync -av wordpress/* /var/www/html/
Give ownership permissions for the web directory:
sudo chmod -R 755 /var/www/html/
We have installed MySQL with LAMP package. To create a new database, login to your MySQL:
mysql -u root -p
Now create a database:
CREATE DATABASE wordpress_db;
Next, setup database user and password:
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'wp_password';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'wordpress_pw';
After, run this command and user will take privileges:
FLUSH PRIVILEGES;
To log out from your MySQL, run this command:
Exit;
Restart apache and you will be ready for the WordPress installation:
systemctl restart apache2
Now it’s time to install WordPress. Open your browser, go to http://youripaddress (your VPS IP Address is located on your VPS Dashboard) and the setup will start. Be sure that you remember your database information from Step 3 above. Click on the Let’s go button:
In step one, enter your database connection details and click Submit.
If you get this error:
Create WordPress configuration file running this command:
nano /var/www/html/wp-config.phpAnd paste the following text into it:
<?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the * installation. You don't have to use the web site, you can * copy this file to "wp-config.php" and fill in the values. * * This file contains the following configurations: * * * MySQL settings * * Secret keys * * Database table prefix * * ABSPATH * * @link https://codex.wordpress.org/Editing_wp-config.php * * @package WordPress */ // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'wordpress_db' ); /** MySQL database username */ define( 'DB_USER', 'wordpress_user' ); /** MySQL database password */ define( 'DB_PASSWORD', 'wordpress_pw' ); /** MySQL hostname */ define( 'DB_HOST', 'localhost' ); /** Database Charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8mb4' ); /** The Database Collate type. Don't change this if in doubt. */ define( 'DB_COLLATE', '' ); /**#@+ * Authentication Unique Keys and Salts. * * Change these to different unique phrases! * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. * * @since 2.6.0 */ define( 'AUTH_KEY', 'Jz$ E ]1ib$$&+v@~Ryb*iMDW-`QxZ7=;bxrN7L1vdw-q5/2O$}n7ur:I;ZBUkW7' ); define( 'SECURE_AUTH_KEY', 'oBN$329-XP%2*dD1mliN4l7u3K*F!Dzkrm`Z{@iz821{t40Dt;M<u{oYw_nHAp)[' ); define( 'LOGGED_IN_KEY', ' #5IL$xSdo3-:e]&ksNl[Q(nyD)q f?F~_Jd-!; x1+c5G`<iVN_PQL=/?$Auuj}' ); define( 'NONCE_KEY', 'AJbnJ_LW8K9S ru~F~<|r`q0bKDFKh,Nq&]ZA4[gysSBVCHo&vY{ZSD>#N3L8$O?' ); define( 'AUTH_SALT', ';s#CDj}kB]W!iT+03zsUyja&BD:S(WPj7[Xo]z!7}.M~@QGH:94wSkiES1|QD3@b' ); define( 'SECURE_AUTH_SALT', 'l&?NUf!4ov#2kX9B:c1,wNIrAuJ/_O>R@4Y/sW;,8a/Zqbz+ap|sQ5 =Gn}y;c+D' ); define( 'LOGGED_IN_SALT', '}&.x_<. IX_RTl@p><1w7kn@}EH[wiisNt|Sy$W^CS}<(7wkz,Nl0iNNBa9~H$q[' ); define( 'NONCE_SALT', '*aNXF|5%-kL6:^F4[KoS6;^K3sCj|Uc3<D!CgY^+Ru`DAN6Xm@TMT2|AQC#GVa|_' ); /**#@-*/ /** * WordPress Database Table prefix. * * You can have multiple installations in one database if you give each * a unique prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wp_'; /** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. * * For information on other constants that can be used for debugging, * visit the Codex. * * @link https://codex.wordpress.org/Debugging_in_WordPress */ define( 'WP_DEBUG', false ); /* That's all, stop editing! Happy publishing. */ /** Absolute path to the WordPress directory. */ if ( ! defined( 'ABSPATH' ) ) { define( 'ABSPATH', dirname( __FILE__ ) . '/' ); } /** Sets up WordPress vars and included files. */ require_once( ABSPATH . 'wp-settings.php' );Hit Ctrl+X and Enter to save changes on your configuration file.
After, click Run the installation button.
Now create an admin account and site title:
After completing the following information, click on the Install WordPress button.
Go to http://youripaddress/wp-admin to access your WordPress admin panel:
Now you have full access to your WordPress site.
You have successfully installed WordPress on Ubuntu! Now you can easily create posts and design your website as you like.
How to Point a Domain Name to an IP Address
How to Secure a Website with Free SSL Certificates from Let's Encrypt
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article