Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
17 views

Linux Commands

The document provides step-by-step instructions for setting up a remote server with a static IP address, installing LAMP stack components like Apache, MySQL, and PHP, creating a WordPress database, and configuring WordPress.

Uploaded by

Kirubel Lemma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Linux Commands

The document provides step-by-step instructions for setting up a remote server with a static IP address, installing LAMP stack components like Apache, MySQL, and PHP, creating a WordPress database, and configuring WordPress.

Uploaded by

Kirubel Lemma
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

****** Remote Access ******

ssh kirubel@10.10.1.131
****** Static IP Config ******
1 --- sudo vi /etc/netplan/01-netcfg.yaml
2 --- network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- IP/SUBNET MASK
nameservers:
addresses: [8.8.8.8, DNS SERVER]
routes:
- to: default
via: GATEWAY
3 --- sudo netplan apply

****** Root user access ******


sudo su -

****** Setup and Install WP ******


1 --- Install Apache
2 --- Install MySQL
3 --- Install PHP
4 --- Install WP
5 --- Create a DB for WP
6 --- Setup and Configure WP
***** Apache Installation (Web-server) *****
1 --- sudo apt update
2 --- sudo apt install apache2
3 --- sudo systemctl status apache2 (check apache service)
4 --- sudo systemctl status ufw (check firewall service)
5 --- sudo systemctl restart apache2.service (restart apache)

****** MySQL Installation (DB Server) *****


1 --- sudo apt update
2 --- sudo apt install mysql-server
3 --- sudo service mysql start
4 --- sudo mysql_secure_installation
5 --- sudo mysql -u root

****** PHP Installation ******


1 --- sudo apt update
2 --- sudo add-apt-repository ppa:ondrej/php
3 --- sudo apt install php
4 --- sudo apt install php8.2

*** PHP-CLI (Command Line Interface)


sudo apt install php-cli or sudo apt-get install php8.2-cli

*** PHP-CGI (to execute PHP scripts without installing the Apache PHP module)
sudo apt install php-cgi

*** PHP-MySQL (to use MySQL with PHP)


sudo apt install php-mysql
*** Run interactive PHP Shell
php -a

*** Open PHP file


php filename.php
*** Login to SQL
sudo mysql -u root -p

*** Backup SQL


mysqldump -u root –p project1 > backup_project1.sql

*** Restore SQL


mysql -u wordpress –p hagbesplc < hagbesplc.sql

*** Grant privileges


GRANT ALL PRIVILEGES ON hagbesplc.* TO 'wordpress'@'localhost';

****** WordPress Installation ******


1 --- cd /var/www/html (to setup LAMP(LINUX APACHE MYSQL PHP) environment)
2 --- sudo wget -c http://wordpress.org/latest.tar.gz
3 --- sudo tar -xzvf latest.tar.gz
4 --- ls -l
5 --- The extracted WP file will be in /var/www/html/wordpress.
6 --- cp -r /var/www/html/Hagbes /var/www/html/wordpress (copy the WP file from your
current folder to /var/www/html/ [Root])
6 --- sudo chown -R www-data:www-data /var/www/html/wordpress (to change the
ownership of these files and set permissions)
sudo chmod -R 755 /var/www/html/ (given permisssion)
****** Create DB for WP ******
1 --- sudo mysql -u root -p
2 --- CREATE DATABASE DB_NAME;
3 --- CREATE USER demo_user@localhost IDENTIFIED BY 'demo-password';
4 --- GRANT ALL PRIVILEGES ON demo_db. * TO demo_user@localhost;
5 --- FLUSH PRIVILEGES; (to implement changes)

****** Setup and Configure WP ******


1 --- mv wp-config-sample.php config-filename.php (create configuration file for WP and
move wp-config-sample.php)
2 --- vi config-filename.php (edit configuration file of WP)

You might also like