-
-
Save kngvamxx/2e19681e6441ea2a26491d5c590ab290 to your computer and use it in GitHub Desktop.
Install WordPress on Ubuntu 18.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Apache | |
sudo apt update | |
sudo apt upgrade | |
sudo apt install apache2 | |
apache2 -v | |
sudo service apache2 start | |
sudo systemctl enable apache2 | |
sudo service apache2 stop | |
sudo service apache2 start | |
sudo service apache2 restart | |
sudo systemctl status apache2 | |
firefox http://localhost/ | |
# Install MySQL & check version, start,stop & restart Apache | |
sudo apt install mysql-server | |
sudo mysql_secure_installation | |
mysql --version | |
sudo service mysql start | |
sudo service mysql enable | |
sudo service mysql stop | |
sudo service mysql start | |
sudo service mysql restart | |
sudo systemctl status mysql | |
# Create MySQL DB, User | |
sudo mysql -u root -p | |
CREATE DATABASE hira DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; | |
GRANT ALL ON hira.* TO 'user'@'localhost' IDENTIFIED BY 'HiRa2019P@'; | |
FLUSH PRIVILEGES; | |
EXIT; | |
# Install PHP & check version | |
sudo apt install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php | |
php --version | |
# Install PHPmyAdmin | |
sudo apt update | |
sudo apt install phpmyadmin php-mbstring php-gettext | |
sudo nano /etc/apache2/apache2.conf | |
# Then add the following line to the end of the file: | |
# Include /etc/phpmyadmin/apache.conf | |
# Then restart apache: | |
sudo service apache2 restart | |
sudo systemctl status apache2 | |
# Install WordPress | |
cd /var/www/html | |
wget -c http://wordpress.org/latest.zip | |
unzip latest.zip | |
chown -R www-data:www-data wordpress | |
rm latest.zip | |
cd /var/www/html/wordpress | |
mv wp-config-sample.php wp-config.php | |
nano wp-config.php | |
# replacing database_name_here, username_here and password_here with your own details | |
#// ** MySQL settings - You can get this info from your web host ** // | |
#/** The name of the database for WordPress */ | |
#define('DB_NAME', 'wordpress'); | |
#/** MySQL database username */ | |
#define('DB_USER', 'user'); | |
#/** MySQL database password */ | |
#define('DB_PASSWORD', 'HiRa2019P@'); | |
#/** MySQL hostname */ | |
#define('DB_HOST', 'localhost'); | |
#/** Database Charset to use in creating database tables. */ | |
#define('DB_CHARSET', 'utf8'); | |
#/** The Database Collate type. Don't change this if in doubt. */ | |
#define('DB_COLLATE', ''); | |
# Create the Virtual Host Files | |
sudo nano /etc/apache2/sites-available/000-default.conf | |
# And add the following content to the file: | |
<VirtualHost *:80> | |
ServerAdmin admin@your_domain.com | |
ServerName your_domain.com | |
ServerAlias www.your_domain.com | |
DocumentRoot /var/www/html/wordpress | |
<Directory /var/www/html/wordpress> | |
Options Indexes FollowSymLinks | |
AllowOverride All | |
Require all granted | |
</Directory> | |
ErrorLog ${APACHE_LOG_DIR}/your_domain.com_error.log | |
CustomLog ${APACHE_LOG_DIR}/your_domain.com_access.log combined | |
</VirtualHost> | |
# To enable the virtual host | |
ln -s /etc/apache2/sites-available/your_domain.com.conf /etc/apache2/sites-enabled/your_domain.com.conf | |
# configure wordpress | |
http://localhost/wordpress/wp-admin/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment