Category Archives: learning

How to Install WordPress on Nginx on CentOS 7

Hi there,

This tutorial will show you how to install WordPress using Nginx on CentOS 7. You will need the following commands to follow along with this tutorial.

First we’ll need to install additional repos that include php71 and then install php71. The commands to do so are:

  • sudo wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  • sudo rpm -Uvh remi-release-7.rpm
  • sudo yum install yum-utils -y
  • sudo yum-config-manager –enable remi-php71
  • sudo yum –enablerepo=remi,remi-php71 install php-fpm php-common
  • sudo yum yum –enablerepo=remi,remi-php71 install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

 

Next we will download WordPress, place it in the directory that we want and then correct the permissions for that folder.

  • sudo wget https://wordpress.org/latest.tar.gz
  • sudo mv latest.tar.gz /usr/share/nginx/htm
  • cd /usr/share/nginx/htm
  • sudo tar -zxvf latest.tar.gz
  • sudo chown -R nginx:nginx /usr/share/nginx/html/wordpress
  • sudo chmod -R 755 /usr/share/nginx/html/wordpress
  • sudo setenforce 0

Now lets set up a config file for our wordpress site. Run the command below and then copy and paste the text into your file, insuring that you enter your IP address into the file.

  • sudo vi /etc/nginx/conf.d/default.conf
server {
 listen 80;
 server_name YOURIPADDRESS;
 
 # note that these lines are originally from the "location /" block
 root /usr/share/nginx/html/wordpress;
 index index.php index.html index.htm;
 
 location / {
 try_files $uri $uri/ =404;
 }
 error_page 404 /404.html;
 error_page 500 502 503 504 /50x.html;
 location = /50x.html {
 root /usr/share/nginx/html;
 }
 
 location ~ \.php$ {
 try_files $uri =404;
 fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 include fastcgi_params;
 }
}

Next make some final changes to your php configuration. Run the command:

  • sudo vi /etc/php-fpm.d/www.conf

Make the following changes to this file.

  • user = apache to user = nginx
  • group = apache to group = nginx
  • listen.owner = nobody to listen.owner = nginx
  • listen.group = nobody to listen.group = nginx
  • Finally append under  this line listen = 127.0.0.1:9000
    • listen = /var/run/php-fpm/php-fpm.sock

Now restart all relevant services and ensure that they are all configured to start when the server boots.

  • sudo service php-fpm restart
  • sudo service nginx restart
  • sudo chkconfig php-fpm on
  • sudo chkconfig nginx on

Now lets do the DB settings needed.

  • mysql -u root -p
  • CREATE DATABASE wordpress;
  • GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY ‘password123’;
  • FLUSH PRIVILEGES

How to Install Nginx Web Server on CentOS 7

NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. It is a rival to the Apache web server and used extensively throughout the internet.

This tutorial will show you how to install Nginx on CentOS 7.

So to begin we’ll need to ensure that we have epel repository installed. We can do so by running the command:

  • sudo yum install epel-release

Next we can install Nginx using yum. The command to do so is:

  • sudo yum install nginx.

Next we’ll start the Nginx web server and insure it starts when the server is powered on. The two commands to do this are:

  • sudo service nginx start
  • sudo chkconfig nginx on

Now we need to navigate to our localhost. To do so open a browser window and type in localhost. You should see a screen similar to the one below:

Now that we know that Nginx is working as we expect, lets remove the default Index.html and enter our own. First delete the default index.html by running:

  • sudo rm /usr/share/nginx/html/index.html

Now create your own file using vi:

  • sudo vi /usr/share/nginx/html/index.html

Enter some test text into your file and save it. Now refresh your browser window. You should see the changes replicated. When we refreshed ours it looked like the image below:

 

A full video tutorial on how to install Nginx can be found here:

How to reset the root password on CentOS 7 / Redhat 7 (RHEL 7)

This tutorial will show you how to reset the root password on CentOs 7 / Redhat 7. As a health warning please be sure that when doing this you have taken a snapshot of your VM or if it’s a physical server that you follow the instructions very carefully. With that in mind lets get started.

Step 1

When the system boots up press e on this screen.

Step 2

In the screen that appears scroll down to the line were you see Linux 16

Now Change where its says ro to:

rw init=/sysroot/bin/sh

Then press ctrl + x

Step 3

You will now be in emergency mode which will look like the screen below:

Step 4

Type in the command:

chroot /sysroot

Step 5

Reset the root password by typing in:

passwd root

Step 6

No ensure that selinux will be relabelled by typing the command:

touch /.autorelabel

Step 7

Type in:

exit

Step 8

Now reboot by typing in:

reboot

How to install Joomla 3 on CentOs 7 /Redhat 7 Linux.

This tutorial shows you how to install Joomla 3 on CentOS 7 / Redhat 7 Linux (RHEL).It shows you first how to download, unzip and move the Joomla files to the correct directory for apache.

 

Next it shows you how to download and install php including the php-mysqli extension that is needed by Joomla. You will then see how to configure Apache to see the Joomla files.

 

Next you will then configure permissions and set up your Joomla Database in MYSQL (MariaDB) Finally you will install Joomla.

 

 

The commands that you need to follow along with this tutorial are:

 

Downloading, Unzipping and Moving Joomla:

 

sudo Wget https://downloads.joomla.org/cms/joomla3/3-8-3/Joomla_3-8-3-Stable-Full_Package.zip?format=zip
Sudo mkdir Joomla
Sudo mv Joomla_3-8-3-Stable-Full_Package.zip\?format\=zip Joomla
Cd Joomla
Sudo unzip Joomla_3-8-3-Stable-Full_Package.zip\?format\=zip Joomla
Sudo rm Joomla_3-8-3-Stable-Full_Package.zip\?format\=zip
Sudo mv Joomla /var/www/html

 

Installing PHP

 

Sudo yum install php
Sudo yum install php-mysqli

 

Configuring Apache and Permissions  

 

Sudo vi /etc/httpd/conf/httpd.conf
Sudo service httpd restart
Sudo chown apache:apache -R /var/www/html/Joomla
Sudo chcon -Rv –type=httpd_sys_rw_content_t /var/www/html

Configuring MYSQL / MariaDB

 

Mysql -u root -p
Create database joomla;
grant all on joomla.* to ‘darren’@’localhost’ identified by ‘password123’;

 

 

How to Install Microsoft Windows Server 2016 on VMware workstation

This video shows you how to install Microsoft Windows Server 2016 as a Virtual machine in VMWare workstation 12. To follow along with the tutorial you will first need to download the evaluation version of Windows Server 2016 from Microsoft, which is available from their evaluation site: https://www.microsoft.com/en-us/evalc… Once completed, you can follow the steps in the video to install Windows Server 2016.

 

 

Linux Tutorial for Beginners: Navigating the File System

In this short tutorial you will learn the basics of navigating the Linux file system.

By the end of this tutorial you will know how to:

1. Change directory.

2. Print you working directory.

3. List the contents of a directory.

4. Switch quickly between the current and previous directory.

 

The commands that you need to follow this tutorial are:

 

  • pwd (print working directory shows the directory that you are currently in)
  • ls (list the contents of the folder)
  • ls Downloads (lists the contents of the downloads folder)
  • Cd / (move back to root (top) level of your operating system)
  • ls -lt (shows newest file first)
  • cd – (switch between the current and previous folder)
  • cd .. (Move back up one directory)
  • cd ~ (moves you to your home folder)

 

How To Install WordPress On Centos 7

This video shows you how to Install WordPress on Centos 7.

The commands that you need to follow along with the tutorial are:

 

Installing PHP.

  • sudo yum install php
  • sudo yum install php-mysqli

 

Setting up the Database.

  • Mysql -u root -p
  • CREATE DATABASE wordpress;
  • GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY ‘password123’;
  • FLUSH PRIVILEGES;

 

Downloading WordPress and getting it ready for install.

  • wget http://wordpress.org/latest.tar.gz
  • tar -zxvf latest.tar.gz
  • sudo mv wordpress/ /var/www/html/
  • sudo chown -R apache:apache /var/www/html/wordpress/
  • sudo chcon -Rv –type=httpd_sys_rw_content_t /var/www/html/wordpress
  • sudo vi /etc/httpd/conf/httpd.conf

 

How To Install Python 3 on CentOS 7

Subscribe to Darrenoneill.eu to get a free Linux Cheat Sheet! 

This tutorial shows you how to install Python 3, set up a local programming environment and create your first python program. The commands that you need to follow along with this tutorial are:

 

Getting your Server ready for the install:
sudo yum update
sudo yum install yum-utils
sudo yum groupinstall development
sudo yum -y install https://centos7.iuscommunity.org/ius-release.rpm

 

Installing Python and PIP
sudo yum -y install python36u
python3.6 -V
sudo yum -y install python36u-pip
sudo yum -y install python36u-devel

 

Setting up your local environment.
mkdir environments
cd environments
python3.6 -m venv my_env
source my_env/bin/activate

 

Creating your python program:Vi HelloWorld.py
print(“Hello, World!”)
HelloWorld.py

 

How To Install Own Cloud on CentOS 7

This video shows how to install Own Cloud on Centos. Own Cloud is simailr to dropbox but you install it on your own server which gives you full control over your data. There are several prerequisites needed to follow along with this video, which I have also included below.

Firstly the commands needed are:

sudo rpm –import https://download.owncloud.org/download/repositories/stable/CentOS_7/repodata/repomd.xml.key

 

sudo curl -L https://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo -o /etc/yum.repos.d/ownCloud.repo

 

sudo yum clean expire-cache

 

sudo yum install owncloud

 

sudo mysql -u root -p

 

CREATE DATABASE owncloud;

 

GRANT ALL ON owncloud.* to ‘owncloud’@’localhost’ IDENTIFIED BY ‘password123’;

 

FLUSH PRIVILEGES

 

exit

 

sudo setenforce 0

 

How To Install Own Cloud on CentOS 7:

 

 

How To Install Apache (HTTPD) On CentOs7:

How to download and install MariaDB (MySQL) on centos 7:

 

How to set up Lets Encrypt on CentOS 7

How To Disable SELinux on CentOS 7

SOLVED: ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

This video shows how to correct the error:

 

ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

 

The commands that you will need to run to correct the error are:

 

SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_large_prefix=on;