Category Archives: Computer Science

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 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 Install Wildfly on windows

“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.”

In this tutorial we will be installing Wildfly on windows server 2016, however the process should be much the same on windows 10.

Installing Java

First we will download and install Java JRE. it is available from:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

And we downloaded the windows 64 bit version.

Once it downloads install it.

Downloading WildFly

Go to http://wildfly.org/downloads and click to download the Java EE7 Full & Web Distribution

When it downloads unzip it to your C drive.

Running WildFly for the first time.

Navigate to C:\wildfly-12.0.0.Final\bin and run standalone.ps1 in PowerShell

When WildFly has started you should see a screen similar to the below:

Now open a browser and navigate to http://localhost:8080 you should see the WildFly welcome screen:

 

  • Next minimise your browser and navigate back to  C:\wildfly-12.0.0.Final\bin.
  • Run add-user.ps1 with PowerShell by right clicking and selecting run with PowerShell

 

Add a management user by pressing enter at the below screen (it is the default option)

  • Enter the details of your user.
  • when asked “What groups do you want this user to belong to?” press enter
  • and then type yes to add the user for the realm ManagemntRealm

  • When asked; “Is this new user going to be used for one AS process to connect to another AS process?” type no
  • Return to the PowerShell window that has WildFly running and press ctrl+c to kill the process, the PowerShell window should close.
  • open a bowser and navigate to
    • http://localhost:9990
  • You will be promoted to log in, enter the username and password that you set and click ok.

  • You should now see the management console.

 

  • Minimise your browser and navigate back to the PowerShell window and stop wildly by running ctrl + c

Installing WildFly as a service.

  • navigate to C:\wildfly-12.0.0.Final\docs\contrib\scripts\
  • Copy the service directory to C:\wildfly-12.0.0.Final\bin

  • open up and admin CMD and navigate into C:\wildfly-12.0.0.Final\bin\service

Next run “service.bat install”

Next open windows Services, you should see WilDfly installed, you can now start it from here and set it to automatic.

a full video tutorial can be found here:

How To Install Tomcat on CentOS 7

Hi there,

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

“The Apache Tomcat® software is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies.”

The steps that you need to follow are detailed below. Just copy and paste them into your CentOS 7 server and all should work. If not please do comment below and I will respond as soon as I can.

First we need to download Tomcat:

  • sudo yum install tomcat

Now we will edit the tomcat.conf file, enter the below command to you CentOS machine:

  • sudo vi /usr/share/tomcat/conf/tomcat.conf

Now appened the below line to the end of the file.

JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx1026m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC"

Next we’ll install the web application manager and the documentation, run the two following commands:

  • sudo yum install tomcat-webapps tomcat-admin-webapps
  • sudo yum install tomcat-docs-webapp tomcat-javadoc

Now we’ll edit the user.xml file to allow use to get into the web manger application, enter the following command:

  • sudo vi /usr/share/tomcat/conf/tomcat-users.xml

 

Next add this line between the <tomcat-users> Tags.

<user username="admin" password="password" roles="manager-gui,admin-gui"/>

Note the username and password, we will need this shortly.

Enter the two following commands to start the service and to ensure that the service is started when Centos powers on

  • sudo service tomcat start
  • sudo chkconfig tomcat on

Now, open a browser and navigate to localhost over port 8080

  • https://localhost:8080

you should see Tomcat running:

Now click Manager app

Enter the following details:

  • Username: admin
  • Password: password

You are now in the Web application manager.

 

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 Connect To Linux (CentOs 7) Using SSH Keys (Password free authentication) from Windows

This video shows how to log into a CentOs 7 server from a Windows machine using SSH keys. The video will show you how to generate the keys using Putty and then how to configure your CentOS 7 Server to allow you to authenticate into the server.

Putty is available to download from www.putty.org.

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

sudo mkdir ~/.ssh
sudo chmod 700 ~/.ssh
sudo vi ~/.ssh/authorized_keys
sudo chown YourUserName:YourUserName ~/.ssh -R
sudo chmod 600 ~/.ssh/authorized_keys

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 create virtual hosts on Apache (httpd) on CentOs 7

Using virtual hosts on Apache allows you to host multiple websites on one server. In order for virtual hosts to function correctly you will need to insure that you have DNS set up correctly for your sites. If you are following this tutorial for test purposes you can reference this video on how to manually set DNS on a Centos Server:

If you need to know how to install apache on CentOs you can reference this video:

The commands that you need to follow this video are:

cd /var/www/html/
sudo mkdir site1
sudo mkdir site2

sudo chown apavhe:apache -R site1
sudo chown apavhe:apache -R site2

sudo vi site1/index.html
sudo vi site2/index.html

cd /ete/httpd/
sudo mkdir sites-available
sudo mkdir sites-enabled

sudo vi /etc/httpd/conf/httpd.conf

Add this line to the end of your file:

IncludeOptional sites-enabled/*.conf

cd sites-avaiable

sudo vi site1.com.conf

<VirtualHost *:80>

ServerName www.site1.com
ServerAlias site1.com
DocumentRoot /var/www/html/site1/
ErrorLog /var/www/html/site1/error.log
CustomLog /var/www/html/site1/requests.log combined
</VirtualHost>

sudo cp site1.com.conf site2.com.conf

sudo vi site2.com.conf

<VirtualHost *:80>

ServerName www.site2.com
ServerAlias site2.com
DocumentRoot /var/www/html/site2/
ErrorLog /var/www/html/site2/error.log
CustomLog /var/www/html/site2/requests.log combined
</VirtualHost>

sudo ln -s /etc/httpd/sites-available/site1.com.conf /etc/httpd/sites-enabled/site1.com.conf
sudo ln -s /etc/httpd/sites-available/site2.com.conf /etc/httpd/sites-enabled/site2.com.conf

sudo service httpd restart

Disable selinux

sudo setenfoce 0

 

How To Install VMWare Tools On Kali Linux

To Install VMware tools on Kali Linux you first need to update and upgrade the system by running the two following commands:

 

  • apt-get update
  • apt-get upgrade

Once these two commands have run you then need to reboot the system by typing in:

 

  • init 6

Once the system has booted back up you then need to install the VMWare tools by running:

 

  • apt-get install open-vm-tools-desktop fuse

Once this is done you need to reboot one final time by typing in the command:

 

  • init 6

When the machine boots back up VMWare tools will be installed.

 

You can see the entire process by watching the video below:

 

 

 

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;