Category Archives: CentOS

How to Install CentOS 8 on VirtualBox 2020

This CentOS 8 tutorial will show you how to install CentOS 8 on VirtualBox. To begin you will see how to create a Virtual machine on VirtualBox. Next you will see how to download CentOS 8 to windows. Next you will see the CentOS 8 installation process. You will mount the CentOS 8 installation media into VirtualBox. Next you will see the CentOS 8 installation process step by step.7 Finally you will log into CentOS 8 server. This installation of CentOS 8 on VirtualBox take place on windows, in affect showing you how to run CentOS 8 on windows 10. The Install process will be the same if you are running on a physical machine.

How to install apache (httpd) on CentOS 8

This tutorial will show you how to install the Apache web server on CentOS 8.

You will need to log into your CentOS 8 server and run the following commands:

  • sudo yum install httpd
    • When prompted press y to confirm the installation.
  • sudo service httpd start
    • This starts the apache service
  • sudo service httpd status
    • This insures that the service is running, your output should look similar to the output below.

  • sudo chkconfig httpd on
    • This insures that the apache service is powered on when the server boots.
  • Next create a file called index.html in the apache root directory by running the following command
    • sudo vi /var/www/html/index.html
  • Press i to go into insert mode and add the following text
    • <html> this is my web serer </html>
  • press esc and then type wq! to quit and save the file.
  • You can now navigate to your servers ip address or dns name, you should now see a screen similar to the one below.

 

A full video can be seen here:

Solved firewall-cmd command not found

This short video will show you how to correct the error:

This error is actually cased by not having firewalld installed on your system.

In this video you will see how to install firewalld

To fix this issue you need to run the following commands:

sudo yum install firewalld sudo

systemctl start firewalld sudo systemctl

enable firewalld sudo systemctl status firewalld

Once these commands are run you can then start using firewall-cmd command.

How to check MariaDB version

“MariaDB is a community-developed fork of the MySQL relational database management system intended to remain free under the GNU GPL. Development is led by some of the original developers of MySQL, who forked it due to concerns over its acquisition by Oracle Corporation”

This short MariaDB tutorial will show you how to check the version of MariaDB you are running. We are running MariaDB on CentOS 7 but the process should be much the same for other operating systems.

Step 1 

Log into your MariaDB instance, in our case we log in using the command:

mysql -u root -p

Step 2

After you log in you can see your version in the welcome text – highlighted in the screen-grab below:

Step 3

If you cannot see your version here you can also run the following command to see it:

SELECT VERSION();

A full video tutorial on the process can be found here:

 

 

How to Setup CentOS 7 on AWS

This tutorial will show you how to create a CentOS 7 instance on AWS. We assume that you already have you AWS account created and that you are logged in already.

Step 1

Click Services and then EC2

Step 2

Click Launch Instance

Step 3

  • Click AWS Marketplace
  • Search for CentOS
  • Select the top result – CentOS7

Step 4

Click Continue

Step 5

Select your machine type and click Next Configure Instance details. In our case we will select the t2.micro instance as it is free tier eligible.

Step 6

Change Auto-assign public IP to Enable and click Next: Add storage.

Step 7

Leave the defaults and click Next:Add Tags

Step 8

Click Next: Configure Security Group

Step 9

Click review and Launch.

Step 10

Review your settings and then click Launch.

Step 11

In the drop down menu select create a new key pair, give the key pair a name and Download the Key Pair, then click launch Instances.

Step 12

Click your instance ID to see the instance.

You should now see your instance.

Step 13

To connect to our instance we will need to convert the key we downloaded, to do so we will use putty and puttygen they can be downloaded form here: https://www.putty.org/

Open puttygen and click Load

Step 14

Navigate to where you downloaded your key, click all files, click on your key and click open.

Step 15

Now click Save Private key, when prompted click yes you want to save without a passphrase.

Step 16

Now open putty and enter your public IP into the host name or IP address field, then expand SSH on the left had side.

Step 17

Click auth and then browse, navigate to where you saved your key and select it.

Step 18

Now click open

Step 19

Click Yes

Step 20

Enter centos as the username and click enter.

You will now be logged in

A full video tutorial can be found here:

How to Run Wildfly on CentOS 7

WildFly, formerly known as JBoss AS, or simply JBoss, is an application server authored by JBoss, now developed by Red Hat. WildFly is written in Java and implements the Java Platform, Enterprise Edition (Java EE) specification. It runs on multiple platforms.

WildFly is free and open-source software, subject to the requirements of the GNU Lesser General Public License (LGPL), version 2.1.

This tutorial will show you how to install Wildfly on Centos 7.

Step 1

To run Wildfly you need Java, so we will download it now, run the command:

yum -y install java-1.8.0-openjdk

Confirm that it is installed correctly by running:

java -version

Step 2

Let’s get the firewall ready, there are two ports we need open, lets open them now, run the following commands:

sudo firewall-cmd –zone=public –add-port=8080/tcp –permanent
sudo firewall-cmd –zone=public –add-port=9990/tcp –permanent

Now reload the firewall to ensure the changes take effect:

sudo firewall-cmd –reload

Step 3

Now lets download wildfly, run the command:

wget http://download.jboss.org/wildfly/14.0.1.Final/wildfly-14.0.1.Final.tar.gz

Step 4

Now lets un-pack the tar file, run:

sudo tar -zxf wildfly-14.0.1.Final.tar.gz

Step 5

Now let’s edit some config files first we need to move to the relevant directory, run the command.

cd wildfly-14.0.1.Final/standalone/configuration

We need to edit the standalone.xml file.

We will use vi for this, run:

vi standalone.xml

look for the section:

<interfaces>
<interface name=”management”>
<inet-address value=”${jboss.bind.address.management:127.0.0.1}”/>
</interface>
<interface name=”public”>
<inet-address value=”${jboss.bind.address:127.0.0.1}”/>
</interface>
</interfaces>

Note the 127.0.0.1 we will change this to 0.0.0.0, the block of text should look like so:

<interfaces>
<interface name=”management”>
<inet-address value=”${jboss.bind.address.management:0.0.0.0}”/>
</interface>
<interface name=”public”>
<inet-address value=”${jboss.bind.address:0.0.0.0}”/>
</interface>
</interfaces>

Step 6

Now lets add a management user. First run:

cd wildfly-14.0.1.Final/bin

Next run the command:

./add-user.sh

You will be greeted with a series of prompts:

a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a):

  • Press enter for the default.

Enter the details of the new user to add.
Using realm ‘ManagementRealm’ as discovered from the existing property files.
Username:

  • Enter a Username

Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
– The password should be different from the username
– The password should not be one of the following restricted values {root, admin, administrator}
– The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password :

  • Enter a password.

What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]:
About to add user ‘wildfly’ for realm ‘ManagementRealm’
Is this correct yes/no

  • Type yes.

Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no?

  • Type no.

Step 7

Now we will start Wildfly, ensure that you are still in the bin directory and run the following command:

./standalone.sh

If the command is successful output should like so (You can ignore any ssl warnings):

Step 8

Lets confirm wildfly is up, open and web browser and navigate to the IP address of your CentOS server and append the port 8080 to the address, in our case it looks like so:

http://192.168.125.3:8080

You should see a screen that looks like so:

Step 9

Now let’s ensure the management interface is working, navigate to

http://192.168.125.3:9990

You should be prompted for a login, enter the username and password you set in step 6.

You should then see the Wildfly management interface.

A full video tutorial can be found here:

How to change the hostname in CentOS 7

First edit the hostname file by typing:

sudo vi /etc/hostname

Delete the line that you see in the file so it our case we deleted:

localhost.localdomain

Now  enter your hostname, in our case we called it darrens centos.

 

We then typed

esc wq!

to write and save the file.

 

We then restart the machine by typing

sudo init 6

When the machine has re-booted type in

hostname

to see the new hostname.

A video tutorial can be found here:

How to install ElasticSearch on CentOS 7

“Elasticsearch is a search engine based on Lucene. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. Elasticsearch is developed in Java and is released as open source under the terms of the Apache License”

This tutorial will show you how to install ElasticSearch on CentOS 7. The version of ElaistcSearch we use is, 1.7.3.

Step 1

We download openJDK by running:

  • sudo yum install java-1.8.0-openjdk.x86_64

Step 2

Next we will get the elasticsearch package by running:

  • sudo wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.3.noarch.rpm

Step 3

We will then install it by running the following command:

  • sudo rpm -ivh elasticsearch-1.7.3.noarch.rpm

Step 4

We will then start and configure the elasticsearch service by running the following commands.

  • sudo service elasticsearch start
  • sudo service elasticsearch status
  • sudo chkconfig elasticsearch on

Step 5

We will now check that elasticsearch is working as we expect. We will navigate to localhost over port 9200 (the default port for elasticsearch)

  • sudo wegt localhost:9200
  • cat index.html

The output of this file should look similar to the below.

{
"status" : 200,
"name" : "Lockjaw",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.7.3",
"build_hash" : "05d4530971ef0ea46d0f4fa6ee64dbc8df659682",
"build_timestamp" : "2015-10-15T09:14:17Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}

A full video tutorial can be found here:

 

How to run a command on Startup on Linux (works on CentOS & Ubuntu)

Hi there,

In this example I had a need to record boot up times in a file that i could access easily. To do so I decided to run a command on startup. This tutorial tool place on CentOS but the commands should also work on Ubuntu.

Step 1

Edit the rc.local file in vi by running:

sudo vi /etc/rc.local

Step 2

Add the following line to the file, update the home directory to represent your home directory.

  • Press i to go into insert mode
  • Enter the line:
    • echo “the computer booted up at” `date` >> /home/darren/bootup.log
  • Press ESC and then wq! and enter to save and quit the file.

Step 3

Give the executable  permission to the rc.local file by running the following command:

chmod +x /etc/rc.d/rc.local

Step 4

Reboot the system by running:

sudo init 6

Step 5

When the machine reboots run the following command to insure the file has been created and that there is content in the file:

cat /home/darren/bootup.log

A full video tutorial can be found here:

How to statically assign DNS in CentOS 7

You can statically assign DNS in Centos 7. In this example we will assign Googles DNS, which is:

8.8.8.8

8.8.44

To begin we will first edit the our internet adaptor, do so run the command:

sudo vi /etc/sysconfig/network-scripts/ifcfg-enpXXX

in our case we ran

 sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

We changed the line

PEERDNS=yes

to:

PEERDNS=no

 

Next we need to edit the resolv.conf file:

 sudo vi /etc/resolv.conf

nameserver 8.8.8.8

nameserver 8.8.4.4