Install Apache:
When you’re done installing Apache2, the below commands allow you to start it up
sudo apt-get update
sudo apt-get install apache2
sudo systemctl start apache2
OR
sudo service apache2 start
If you you are using Nginx you may get the below ERROR:Address already in use: AH00072: make_sock: could not bind to address [::]:80
Then GO to /etc/apache2/ports.conf
and change Listen 80 to Listen 8090 using below command
sudo vim /etc/apache2/ports.conf
open browser and enter http://localhost:8090The below commands allow you to restart it and enable it to startup everytime you reboot your systems.
sudo systemctl restart apache2
sudo systemctl enable apache2
Install MySQL:
sudo apt-get install mysql-server mysql-client libmysqlclient-dev python3-dev
During MySQL database server installation, you’ll be prompted to create a root password.. This password enables the root users to administer MySQL server.
After installing MySQL database server, the commands below allow you to start it up, restart it and enable it so that it starts up automatically everytime you reboot your servers.
sudo systemctl start mysql
OR
sudo service mysql start
sudo systemctl restart mysql
sudo systemctl enable mysql
After running the above commands and installing MySQL, run the commands below to configure it.
sudo mysql_secure_installation
When prompted, choose Yes or No accordingly until you’re done.
mysql -u root -p
CREATE DATABASE DBName;
CREATE USER DBName@localhost IDENTIFIED BY 'new_password_here';
GRANT ALL ON DBName.* to DBName@localhost;
FLUSH PRIVILEGES;
exit;
Install PHP:
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
OR
sudo apt-get install php libapache2-mod-php php-mysql php-curl php-gd php-intl php-pear php-imagick php-imap php-mcrypt php-memcache php-ming php-ps php-pspell php-recode php-sqlite3 php-tidy php-xmlrpc php-xsl
Ones PHP is installed, check the installed version
php --version
to get full details regarding php, create index.php as shown
sudo vim /var/www/html/index.php
Execute the above command and paste the below code in it and save the file by pressing Esc+:wq
<?php
// Shows all information regarding PHP, Apache server, MySQL and Default enabled/Installed Modules of PHP
phpinfo();
?>
Use below url to execute the filehttp://localhost:8090/index.php
To make PHP files as default use below command to change
sudo nano /etc/apache2/mods-enabled/dir.conf
Move index.php to begining as shown below
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
Now restart apache and execute the url http://localhost:8090/
sudo systemctl restart apache2
OR
sudo service apache2 restart
To Install Additional PHP modules
sapt-cache search php- | less
For example to install additional cli module
sudo apt-get install php-cli
Install WordPress:
Download latest WordPress from http://wordpress.org/latest.tar.gz
unzip the above downloaded wordpress and copy in /var/www/html/ folder with the below command.
sudo tar -xvzf /home/vara/Downloads/wordpress-4.8.tar.gz -C var/www/html/
go to localhost:8090/wordpress if every thing is working it will redirect to http://localhost:8090/wordpress/wp-admin/setup-config.php thren press let's go! button and provide mysql details.
You may get the below error
Sorry, but I can’t write the wp-config.php file.
You can create the wp-config.php manually and paste the following text into it.
sudo chmod -R 777 /var/www/html/wordpress
Provide the required details and install wordpress.
No comments:
Post a Comment