How to install wordpress ?
Introduction
[edit]WordPress is a widely used content management system (CMS) that allows users to create and manage websites and blogs with ease. This guide provides step-by-step instructions for installing WordPress on an Apache server running on Ubuntu.
Prerequisites
[edit]Before proceeding with the installation, ensure that you have:
1. A server running Ubuntu.
2. Sudo privileges on the server.
3. Basic knowledge of the Linux command line.
Installation Steps
[edit]Step 1: Install Dependencies
Begin by installing the necessary dependencies for WordPress:
$ sudo apt update
$ sudo apt install apache2 \
$ sudo apt install ghostscript \
$ sudo apt install libapache2-mod-php \
$ sudo apt install mysql-server \
$ sudo apt install php \
$ sudo apt install php-bcmath \
$ sudo apt install php-curl \
$ sudo apt install php-imagick \
$ sudo apt install php-intl \
$ sudo apt install php-json \
$ sudo apt install php-mbstring \
$ sudo apt install php-mysql \
$ sudo apt install php-xml \
$ sudo apt install php-zip
Step 2: Install WordPress
Create the installation directory and download the file from wordpress.org:
$ sudo mkdir -p /srv/www
$ sudo chown www-data: /srv/www
$ curl https://wordpress.org/latest.tar.gz | sudo -u www-data tar zx -C /srv/www
Step 3: Configure Apache for WordPress
Create Apache site for WordPress. Create /etc/apache2/sites-available/wordpress.confwith following lines:
<VirtualHost *:80>
DocumentRoot /srv/www/wordpress
<Directory /srv/www/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /srv/www/wordpress/wp-content>
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
Enable the site with:
$ sudo a2ensite wordpress
Enable URL rewriting with:
$ sudo a2enmod rewrite
Step 4: Configure database
To configure WordPress, we need to create MySQL database.
$ sudo mysql -u root
mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0,00 sec)
mysql> CREATE USER wordpress@localhost IDENTIFIED BY '<your-password>';
Query OK, 1 row affected (0,00 sec)
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
-> ON wordpress.*
-> TO wordpress@localhost;
Query OK, 1 row affected (0,00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 1 row affected (0,00 sec)
mysql> quit
Bye
Enable MySQL with sudo service mysql start.
Step 5: Configure WordPress to connect to the database
First, copy the sample configuration file towp-config.php:
$ sudo -u www-data cp /srv/www/wordpress/wp-config-sample.php /srv/www/wordpress/wp-config.php
$ sudo -u www-data sed -i 's/database_name_here/wordpress/' /srv/www/wordpress/wp-config.php
$ sudo -u www-data sed -i 's/username_here/wordpress/' /srv/www/wordpress/wp-config.php
$ sudo -u www-data sed -i 's/password_here/<your-password>/' /srv/www/wordpress/wp-config.php
Finally, in a terminal session open the configuration file in nano:
$ sudo -u www-data nano /srv/www/wordpress/wp-config.php
Find the following:
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );
Delete those lines (ctrl+k will delete a line each time you press the sequence)
delete above lines and replace it with the below lines.
define('AUTH_KEY', '3^6YZ_e%D8%?7U]h|2Qq|h Yydd=HcAe-zr,RWz^#}9_9,6$z1 :k*RrHkTb2^ca');
define('SECURE_AUTH_KEY', 'u=aX(Q;8<h/KljXB [}=lyK:7p#SkXRR*In&.Bq&/wH`fBF`XIr^p-eM:X,eoF3W');
define('LOGGED_IN_KEY', 'U#+Y,7*;kZ30L-w.-D7)ITkCB14]^P CE&8,ULP.0(_)g+]Hg4J-y{DYS+C2@W(7');
define('NONCE_KEY', '3j6);ow8,U;ON+U(^E]_b;{3-MPYraV4%/K~@(S`np)_e^~ZQj<H@)L-D>qR8rDE');
define('AUTH_SALT', 'S6CpDV|AUM+|<71m@wm$aaqexl-WqcN-7RaP4HKg,fPU5~bf{a6=t!%ovRLj9Y@+');
define('SECURE_AUTH_SALT', '93 E=.Xs~GW$F|#)9kb&;|~4[gIhAC^]Q?^<H|XM|)L~Wd!;=%B:se,2 NK;hoV]');
define('LOGGED_IN_SALT', 'x}Uo;$&>[5+3dv2X.s&o|iZE/BMHBy)L8RT-bfK:gf-wmx4E0^+GDrT&Cd5tZ1EI');
define('NONCE_SALT', 'b[6Gov+-V{Y:Z%{_s,}yKcn+76&0#;pmWKxw]-zZq;NCKE&<-&*JjiPzN_ [+ 2)');
Step 6: Configure WordPress:
Open http://localhost/ in the browser(http://69.30.243.133/)
Conclusion
[edit]You have successfully installed WordPress on your Ubuntu server. You can now log in to the WordPress admin panel and
start building your website or blog.