CentOS


How To Install on GNU/Linux CentOS 7 the LAMP stack (Apache, MySQL, PHP) + phpMyAdmin

Following you will find the commands to perform the installation of the LAMP stack (Apache, MySQL, PHP) and phpMyAdmin on a GNU/Linux CentOS 7.
In this guide we kept the information to the bare minimum about what is what.

Installation

To perform the installation, please execute the following as a user with administrative rights:


#Update your system
sudo yum update -y;
#Install Apache, MariaDB (MySQL), PHP (with MySQL support and phpMyAdmin which is a free software tool written in PHP, intended to handle the administration of MySQL over the Web)
sudo yum install httpd mariadb-server mariadb php php-mysql phpmyadmin -y;
#Start Apache (PHP will start with Apache as module)
sudo systemctl start httpd;
#Enable Apache to start on boot
sudo systemctl enable httpd;
#Start MariaDB(MySQL)
sudo systemctl start mariadb;
#Enable MariaDB(MySQL) to start on boot
sudo systemctl enable mariadb;

Configuration of MariaDB (MySQL)

By now, your system should have all necessary packages installed and the services up and running.
Now it is best to configure your MariaDB (MySQL) in a way to disable some test data and test accounts and assign a password to your root user.
Execute the following to do so:


sudo mysql_secure_installation;

This tool will ask you for your current database root password. Since you just installed MariaDB (MySQL) you should not have one, so leave the field empty and press enter.
We recommend to answer with Y (Yes) in all of the security questions of this tool and set a strong password for your root user.


sudo mysql_secure_installation;

Following is the output we got from this tool:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
 SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
 password for the root user.  If you've just installed MariaDB, and
 you haven't set the root password yet, the password will be blank,
 so you should just press enter here.

Enter current password for root (enter for none):
 OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
 root user without the proper authorisation.

Set root password? [Y/n] Y
 New password:
 Re-enter new password:
 Password updated successfully!
 Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
 to log into MariaDB without having to have a user account created for
 them.  This is intended only for testing, and to make the installation
 go a bit smoother.  You should remove them before moving into a
 production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
 ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
 access.  This is also intended only for testing, and should be removed
 before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
 will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
 installation should now be secure.

Thanks for using MariaDB!

Configuration of the firewall

Executing the following will enable access to your web-server from the network for http and https.


sudo firewall-cmd --permanent --zone=public --add-service=http;
sudo firewall-cmd --permanent --zone=public --add-service=https;
sudo firewall-cmd --reload;

Location of files / Where to upload your website

In CentOS 7, the directory where the website pages are located is at /var/www/html/.
You can place your html and php code there.

Configuration of phpMyAdmin

phpMyAdmin should be available at http://<IP of the web server>/phpmyadmin
The access to phpMyAdmin is controlled by the Apache Virtual Host File for phpMyAdmin that is found here /etc/httpd/conf.d/phpMyAdmin.conf.
By default, this configuration file only allows access to phpMyAdmin from the localhost (127.0.0.1).
In case you want to access it from another machine, you need to modify this file.
Before doing any changes, make a backup of the original file first:

 sudo cp /etc/httpd/conf.d/phpMyAdmin.conf /etc/httpd/conf.d/phpMyAdmin.conf.original;

To enable access only for a specific IP

Edit the Apache Virtual Host File for phpMyAdmin (/etc/httpd/conf.d/phpMyAdmin.conf) and change every reference of 127.0.0.1 with the IP address of the machine you want to give access to.

There should be four lines that you need to change.
In our installation it was the following lines:

  1. 17Require ip 127.0.0.1
  2. 25Allow from 127.0.0.1
  3. 34Require ip 127.0.0.1
  4. 42Allow from 127.0.0.1

Then restart the Apache service to apply the changes:


sudo systemctl restart httpd;

To enable access to any IP

Delete the existing file and create a new one.


sudo rm /etc/httpd/conf.d/phpMyAdmin.conf;
sudo touch /etc/httpd/conf.d/phpMyAdmin.conf;

Using the editor of your choice add the following content and save it:

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
 AllowOverride None
 Options None
 Allow from All
 Require all granted
</Directory>

Then restart the Apache service to apply the changes:


sudo systemctl restart httpd;

Following is the original content of our Apache Virtual Host File for phpMyAdmin (/etc/httpd/conf.d/phpMyAdmin.conf)

$ cat /etc/httpd/conf.d/phpMyAdmin.conf
 # phpMyAdmin - Web based MySQL browser written in php
 #
 # Allows only localhost by default
 #
 # But allowing phpMyAdmin to anyone other than localhost should be considered
 # dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
 AddDefaultCharset UTF-8

 <IfModule mod_authz_core.c>
  # Apache 2.4
  <RequireAny>
   Require ip 192.168.0.20
   Require ip ::1
  </RequireAny>
 </IfModule>
 <IfModule !mod_authz_core.c>
  # Apache 2.2
  Order Deny,Allow
  Deny from All
  Allow from 192.168.0.20
  Allow from ::1
  </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
 <IfModule mod_authz_core.c>
  # Apache 2.4
  <RequireAny>
   Require ip 192.168.0.20
   Require ip ::1
  </RequireAny>
 </IfModule>
 <IfModule !mod_authz_core.c>
  # Apache 2.2
  Order Deny,Allow
  Deny from All
  Allow from 192.168.0.20
  Allow from ::1
 </IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
 <Directory /usr/share/phpMyAdmin/libraries/>
  Order Deny,Allow
  Deny from All
  Allow from None
 </Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
  Order Deny,Allow
  Deny from All
  Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
 Order Deny,Allow
 Deny from All
 Allow from None
</Directory>

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc.  This may break your mod_security implementation.
#
#<IfModule mod_security.c>
#    <Directory /usr/share/phpMyAdmin/>
#        SecRuleInheritance Off
#    </Directory>
#</IfModule>

CentOS: prevent eth0 from starting at boot time

On a CentOS server we own, we had to disable eth0 from starting at boot time
To do so we needed to modify the file /etc/sysconfig/network-scripts/ifcfg-eth0 and set the value ONBOOT="yes" to ONBOOT="no".

Using you favorite text editor, make this change and restart your machine to verify that the change was successful.

Below is the sample content of /etc/sysconfig/network-scripts/ifcfg-eth0 after the change was applied to prevent eth0 from starting at boot time.

  GNU nano 2.3.1                File: /etc/sysconfig/network-scripts/ifcfg-eth0                             Modified

TYPE="Ethernet"
 BOOTPROTO=dhcp
 DEFROUTE="yes"
 IPV4_FAILURE_FATAL="no"
 IPV6INIT="yes"
 IPV6_AUTOCONF="yes"
 IPV6_DEFROUTE="yes"
 IPV6_FAILURE_FATAL="no"
 NAME="eth0"
 UUID="792d6842-221d-5c99-ba98-cddbba4ff263"
 ONBOOT="no"
 HWADDR="00:AA:5D:01:22:2B"
 DNS1="10.15.10.5"
 DOMAIN="bytefreaks.local"
 IPADDR=10.15.10.249
 PREFIX=24
 GATEWAY=10.15.10.1
 PEERDNS=yes
 PEERROUTES=yes
 IPV6_PEERDNS=yes
 IPV6_PEERROUTES=yes

How to Start/Stop or Enable/Disable firewalld on CentOS 7

firewalld (Dynamic Firewall Manager) tool provides a dynamically managed firewall. The tool enables network/firewall zones to define the trust level of network connections and/or interfaces. It has support both for IPv4 and IPv6 firewall settings. Also, it supports Ethernet bridges and allow you to separate between runtime and permanent configuration options. Finally, it supports an interface for services or applications to add firewall rules directly.

Disable firewalld

To disable firewalld, execute the following command as root or using sudo:

systemctl disable firewalld

Enable firewalld

To enable firewalld, execute the following command as root or using sudo:

systemctl enable firewalld

Stop firewalld

To stop (or deactivate) firewalld,execute the following command as root or using sudo:

systemctl stop firewalld

Start firewalld

To start (or activate) firewalld, execute the following command as root or using sudo:

systemctl start firewalld

Status of firewalld

To check the status of firewalld, execute the following command as root or using sudo:

systemctl status firewalld

CONCEPTS

systemd provides a dependency system between various entities called “units” of 12 different types. Units encapsulate various objects that are relevant for system boot-up and maintenance. The majority of units are configured in unit configuration files, whose syntax and basic set of options is described in systemd.unit(5), however some are created automatically from other configuration, dynamically from system state or programmatically at runtime. Units may be “active” (meaning started, bound, plugged in, …, depending on the unit type, see below), or “inactive” (meaning stopped, unbound, unplugged, …), as well as in the process of being activated or deactivated, i.e. between the two states (these states are called “activating”, “deactivating”). A special “failed” state is available as well, which is very similar to “inactive” and is entered when the service failed in some way (process returned error code on exit, or crashed, or an operation timed out). If this state is entered, the cause will be logged, for later reference. Note that the various unit types may have a number of additional substates, which are mapped to the five generalized unit states described here.
— From man systemd

The above, in a nutshell:

  • enabled is a service that is configured to start when the system boots
  • disabled is a service that is configured to not start when the system boots
  • active is a service that is currently running
  • inactive is a service that is currently stopped and may be disabled, but it can be started and become active

Downgrade GNU patch on CentOS 7.0 (64bit) to version 2.6.1

Recently we had to download GNU patch from version 2.7.1 to any version less than version 2.7 series.
We used patch version 2.6.1 which is the latest in the version 2.6 series.

We were trying to compile Linux Kernel 3.0.35 source code with some custom patches.
While applying the patches we got the following errors:

File firmware/imx/sdma/sdma-imx25-to1.bin: git binary diffs are not supported.
File firmware/imx/sdma/sdma-imx31-to1.bin: git binary diffs are not supported.
File firmware/imx/sdma/sdma-imx31-to2.bin: git binary diffs are not supported.
File firmware/imx/sdma/sdma-imx35-to1.bin: git binary diffs are not supported.
File firmware/imx/sdma/sdma-imx35-to2.bin: git binary diffs are not supported.
File firmware/imx/sdma/sdma-imx50-to1.bin: git binary diffs are not supported.
File firmware/imx/sdma/sdma-imx51-to3.bin: git binary diffs are not supported.
File firmware/imx/sdma/sdma-imx53-to1.bin: git binary diffs are not supported.

Apparently, version 2.7 does not support binary diffs.
We can verify this claim from the release announcement.

Support for most features of the “diff –git” format, including renames and copies, permission changes, and symlink diffs. Binary diffs are not supported yet; patch will complain and skip them.

Methodology


#Making sure we are not missing any 32bit libraries since we are on a 64bit machine
yum install glibc.i686 ncurses-libs.i686;
#Download the source code
wget ftp://ftp.gnu.org/gnu/patch/patch-2.6.1.tar.gz;
#Extract the files
tar -zxf patch-2.6.1.tar.gz;
#Navigate to the folder
cd patch-2.6.1;
#Configure the installation and make all necessary checks
./configure;
#Build
make;
#Remove existing version
sudo yum remove patch -y;
#Install
sudo make install;


Installing Jenkins on Red Hat (CentOS 7 64bit) distributions

Following the official guides:

We tried to install Jenkins using the RPM repositories.

sudo yum install java -y;
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo;
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key;
sudo yum install jenkins -y;

Unfortunately, that resulted in an error:

warning: /var/cache/yum/x86_64/7/jenkins/packages/jenkins-2.19.2-1.1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID d50582e6: NOKEY

Public key for jenkins-2.19.2-1.1.noarch.rpm is not installed

Apparently, sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key; failed silently and it did not import the key.

To verify, we executed rpm -qa gpg-pubkey* to display a list of all keys installed for RPM verification. From that list we wanted to see if any of the keys was the one needed by jenkins which should end with the value d50582e6. Since none of them matched, we tried to manually re-import it which failed again.

Our Solution

Our solution, although ugly, was to disable  PGP verification in the file /etc/yum.repos.d/jenkins.repo.

[jenkins]
name=Jenkins-stable
baseurl=http://pkg.jenkins.io/redhat-stable
gpgcheck=0

That was enough to allow us to install the package using:

sudo yum install jenkins -y;

Finally, we started jenkins using sudo service jenkins start;.

Logs from failed installation


[[email protected] ~]$ sudo yum install jenkins -y
[sudo] password for bytefreaks:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.coreix.net
* extras: mirrors.coreix.net
* updates: mirrors.coreix.net
Resolving Dependencies
--> Running transaction check
---> Package jenkins.noarch 0:2.19.2-1.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================================================================================
Package                                                Arch                                                  Version                                                     Repository                                              Size
=======================================================================================================================================================================================================================================
Installing:
jenkins                                                noarch                                                2.19.2-1.1                                                  jenkins                                                 66 M

Transaction Summary
=======================================================================================================================================================================================================================================
Install  1 Package

Total size: 66 M
Installed size: 67 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/jenkins/packages/jenkins-2.19.2-1.1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID d50582e6: NOKEY


Public key for jenkins-2.19.2-1.1.noarch.rpm is not installed


Install terminator in CentOS 7 (64bit)

We installed CentOS 7 (64bit) using this ISO, which we downloaded from http://vault.centos.org/7.1.1503/isos/x86_64/

Once we got the OS started, we executed yum update -y to update all installed packages that were older than the versions in the repositories.
After the update process was complete, we then tried to install terminator using yum.

The Problem

Executing yum install -y terminator resulted in an error:

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.us.leaseweb.net
* extras: mirror.us.leaseweb.net
* updates: mirror.us.leaseweb.net
No package terminator available.
Error: Nothing to do

Solution

To solve the problem we needed to install the Extra Packages for Enterprise Linux (EPEL) repository using yum install -y epel-release.

After the installation was done, we executed yum install -y terminator once more and the installation of terminator succeeded.

Example Logs

Following is the full log from the terminal, showing the correct completion of the installation

[[email protected] bytefreaks]# yum install terminator
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.us.leaseweb.net
 * extras: mirror.us.leaseweb.net
 * updates: mirror.us.leaseweb.net
No package terminator available.
Error: Nothing to do
[[email protected] bytefreaks]# yum install -y epel-release
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.us.leaseweb.net
 * extras: mirror.us.leaseweb.net
 * updates: mirror.us.leaseweb.net
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================
 Package                        Arch                     Version                 Repository                Size
================================================================================================================
Installing:
 epel-release                   noarch                   7-6                     extras                    14 k

Transaction Summary
================================================================================================================
Install  1 Package

Total download size: 14 k
Installed size: 24 k
Downloading packages:
epel-release-7-6.noarch.rpm                                                              |  14 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-6.noarch                                                                      1/1 
  Verifying  : epel-release-7-6.noarch                                                                      1/1 

Installed:
  epel-release.noarch 0:7-6                                                                                     

Complete!
[[email protected] bytefreaks]# yum install terminator -y
Loaded plugins: fastestmirror, langpacks
epel/x86_64/metalink                                                                     |  23 kB  00:00:00     
epel                                                                                     | 4.3 kB  00:00:00     
(1/3): epel/x86_64/group_gz                                                              | 170 kB  00:00:01     
epel/x86_64/primary_db         FAILED                                          
https://ftp.fau.de/epel/7/x86_64/repodata/e11482622ec75721199897552409e0b0b1d6fd798be905c88014f539d027efec-primary.sqlite.xz: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

(2/3): epel/x86_64/primary_db                                                            | 4.3 MB  00:00:12     
(3/3): epel/x86_64/updateinfo                                                            | 674 kB  00:00:18     
Loading mirror speeds from cached hostfile
 * base: mirror.us.leaseweb.net
 * epel: mirror.de.leaseweb.net
 * extras: mirror.us.leaseweb.net
 * updates: mirror.us.leaseweb.net
Resolving Dependencies
--> Running transaction check
---> Package terminator.noarch 0:0.98-3.el7 will be installed
--> Processing Dependency: vte for package: terminator-0.98-3.el7.noarch
--> Processing Dependency: python-psutil for package: terminator-0.98-3.el7.noarch
--> Processing Dependency: python-keybinder for package: terminator-0.98-3.el7.noarch
--> Processing Dependency: gnome-python2-gconf for package: terminator-0.98-3.el7.noarch
--> Processing Dependency: gnome-python2-bonobo for package: terminator-0.98-3.el7.noarch
--> Running transaction check
---> Package gnome-python2-bonobo.x86_64 0:2.28.1-14.el7 will be installed
--> Processing Dependency: gnome-python2-canvas(x86-64) = 2.28.1-14.el7 for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
--> Processing Dependency: gnome-python2(x86-64) = 2.28.1-14.el7 for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
--> Processing Dependency: pyorbit(x86-64) >= 2.0.1 for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
--> Processing Dependency: libbonoboui(x86-64) >= 2.8.0 for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
--> Processing Dependency: libbonobo(x86-64) >= 2.8.0 for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
--> Processing Dependency: libgnomecanvas-2.so.0()(64bit) for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
--> Processing Dependency: libgnome-2.so.0()(64bit) for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
--> Processing Dependency: libbonoboui-2.so.0()(64bit) for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
--> Processing Dependency: libbonobo-activation.so.4()(64bit) for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
--> Processing Dependency: libbonobo-2.so.0()(64bit) for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
--> Processing Dependency: libart_lgpl_2.so.2()(64bit) for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
--> Processing Dependency: libORBit-2.so.0()(64bit) for package: gnome-python2-bonobo-2.28.1-14.el7.x86_64
---> Package gnome-python2-gconf.x86_64 0:2.28.1-14.el7 will be installed
---> Package python-keybinder.x86_64 0:0.3.1-1.el7 will be installed
--> Processing Dependency: keybinder = 0.3.1-1.el7 for package: python-keybinder-0.3.1-1.el7.x86_64
--> Processing Dependency: libkeybinder.so.0()(64bit) for package: python-keybinder-0.3.1-1.el7.x86_64
---> Package python-psutil.x86_64 0:2.2.1-1.el7 will be installed
---> Package vte.x86_64 0:0.28.2-10.el7 will be installed
--> Running transaction check
---> Package ORBit2.x86_64 0:2.14.19-13.el7 will be installed
--> Processing Dependency: libIDL-2.so.0()(64bit) for package: ORBit2-2.14.19-13.el7.x86_64
---> Package gnome-python2.x86_64 0:2.28.1-14.el7 will be installed
---> Package gnome-python2-canvas.x86_64 0:2.28.1-14.el7 will be installed
---> Package keybinder.x86_64 0:0.3.1-1.el7 will be installed
---> Package libart_lgpl.x86_64 0:2.3.21-10.el7 will be installed
---> Package libbonobo.x86_64 0:2.32.1-7.el7 will be installed
---> Package libbonoboui.x86_64 0:2.24.5-7.el7 will be installed
---> Package libgnome.x86_64 0:2.32.1-9.el7 will be installed
--> Processing Dependency: libgnomevfs-2.so.0()(64bit) for package: libgnome-2.32.1-9.el7.x86_64
---> Package libgnomecanvas.x86_64 0:2.30.3-8.el7 will be installed
---> Package pyorbit.x86_64 0:2.24.0-15.el7 will be installed
--> Running transaction check
---> Package gnome-vfs2.x86_64 0:2.24.4-14.el7 will be installed
--> Processing Dependency: libfam.so.0()(64bit) for package: gnome-vfs2-2.24.4-14.el7.x86_64
---> Package libIDL.x86_64 0:0.8.14-8.el7 will be installed
--> Running transaction check
---> Package gamin.x86_64 0:0.1.10-16.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================
 Package                            Arch                 Version                       Repository          Size
================================================================================================================
Installing:
 terminator                         noarch               0.98-3.el7                    epel               3.4 M
Installing for dependencies:
 ORBit2                             x86_64               2.14.19-13.el7                base               176 k
 gamin                              x86_64               0.1.10-16.el7                 base               128 k
 gnome-python2                      x86_64               2.28.1-14.el7                 base                47 k
 gnome-python2-bonobo               x86_64               2.28.1-14.el7                 base                87 k
 gnome-python2-canvas               x86_64               2.28.1-14.el7                 base                34 k
 gnome-python2-gconf                x86_64               2.28.1-14.el7                 base                46 k
 gnome-vfs2                         x86_64               2.24.4-14.el7                 base               839 k
 keybinder                          x86_64               0.3.1-1.el7                   epel                15 k
 libIDL                             x86_64               0.8.14-8.el7                  base                87 k
 libart_lgpl                        x86_64               2.3.21-10.el7                 base                67 k
 libbonobo                          x86_64               2.32.1-7.el7                  base               437 k
 libbonoboui                        x86_64               2.24.5-7.el7                  base               342 k
 libgnome                           x86_64               2.32.1-9.el7                  base               741 k
 libgnomecanvas                     x86_64               2.30.3-8.el7                  base               226 k
 pyorbit                            x86_64               2.24.0-15.el7                 base                51 k
 python-keybinder                   x86_64               0.3.1-1.el7                   epel                19 k
 python-psutil                      x86_64               2.2.1-1.el7                   epel               114 k
 vte                                x86_64               0.28.2-10.el7                 epel               361 k

Transaction Summary
================================================================================================================
Install  1 Package (+18 Dependent packages)

Total download size: 7.1 M
Installed size: 27 M
Downloading packages:
(1/19): gnome-python2-2.28.1-14.el7.x86_64.rpm                                           |  47 kB  00:00:02     
(2/19): gnome-python2-canvas-2.28.1-14.el7.x86_64.rpm                                    |  34 kB  00:00:02     
(3/19): ORBit2-2.14.19-13.el7.x86_64.rpm                                                 | 176 kB  00:00:02     
(4/19): gnome-python2-gconf-2.28.1-14.el7.x86_64.rpm                                     |  46 kB  00:00:01     
(5/19): libIDL-0.8.14-8.el7.x86_64.rpm                                                   |  87 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/epel/packages/keybinder-0.3.1-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for keybinder-0.3.1-1.el7.x86_64.rpm is not installed
(6/19): keybinder-0.3.1-1.el7.x86_64.rpm                                                 |  15 kB  00:00:02     
(7/19): libart_lgpl-2.3.21-10.el7.x86_64.rpm                                             |  67 kB  00:00:01     
(8/19): gnome-vfs2-2.24.4-14.el7.x86_64.rpm                                              | 839 kB  00:00:03     
(9/19): gamin-0.1.10-16.el7.x86_64.rpm                                                   | 128 kB  00:00:07     
(10/19): libgnome-2.32.1-9.el7.x86_64.rpm                                                | 741 kB  00:00:01     
(11/19): libbonoboui-2.24.5-7.el7.x86_64.rpm                                             | 342 kB  00:00:02     
(12/19): pyorbit-2.24.0-15.el7.x86_64.rpm                                                |  51 kB  00:00:00     
(13/19): libbonobo-2.32.1-7.el7.x86_64.rpm                                               | 437 kB  00:00:02     
(14/19): python-keybinder-0.3.1-1.el7.x86_64.rpm                                         |  19 kB  00:00:00     
(15/19): gnome-python2-bonobo-2.28.1-14.el7.x86_64.rpm                                   |  87 kB  00:00:08     
(16/19): python-psutil-2.2.1-1.el7.x86_64.rpm                                            | 114 kB  00:00:00     
(17/19): vte-0.28.2-10.el7.x86_64.rpm                                                    | 361 kB  00:00:01     
(18/19): libgnomecanvas-2.30.3-8.el7.x86_64.rpm                                          | 226 kB  00:00:03     
(19/19): terminator-0.98-3.el7.noarch.rpm                                                | 3.4 MB  00:00:05     
----------------------------------------------------------------------------------------------------------------
Total                                                                           524 kB/s | 7.1 MB  00:00:13     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <[email protected]>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-6.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libart_lgpl-2.3.21-10.el7.x86_64                                                            1/19 
  Installing : libgnomecanvas-2.30.3-8.el7.x86_64                                                          2/19 
  Installing : gnome-python2-2.28.1-14.el7.x86_64                                                          3/19 
  Installing : libIDL-0.8.14-8.el7.x86_64                                                                  4/19 
  Installing : ORBit2-2.14.19-13.el7.x86_64                                                                5/19 
  Installing : libbonobo-2.32.1-7.el7.x86_64                                                               6/19 
  Installing : pyorbit-2.24.0-15.el7.x86_64                                                                7/19 
  Installing : gnome-python2-gconf-2.28.1-14.el7.x86_64                                                    8/19 
  Installing : gnome-python2-canvas-2.28.1-14.el7.x86_64                                                   9/19 
  Installing : vte-0.28.2-10.el7.x86_64                                                                   10/19 
  Installing : keybinder-0.3.1-1.el7.x86_64                                                               11/19 
  Installing : python-keybinder-0.3.1-1.el7.x86_64                                                        12/19 
  Installing : python-psutil-2.2.1-1.el7.x86_64                                                           13/19 
  Installing : gamin-0.1.10-16.el7.x86_64                                                                 14/19 
  Installing : gnome-vfs2-2.24.4-14.el7.x86_64                                                            15/19 
  Installing : libgnome-2.32.1-9.el7.x86_64                                                               16/19 
  Installing : libbonoboui-2.24.5-7.el7.x86_64                                                            17/19 
  Installing : gnome-python2-bonobo-2.28.1-14.el7.x86_64                                                  18/19 
  Installing : terminator-0.98-3.el7.noarch                                                               19/19 
  Verifying  : libbonobo-2.32.1-7.el7.x86_64                                                               1/19 
  Verifying  : libgnome-2.32.1-9.el7.x86_64                                                                2/19 
  Verifying  : libgnomecanvas-2.30.3-8.el7.x86_64                                                          3/19 
  Verifying  : gamin-0.1.10-16.el7.x86_64                                                                  4/19 
  Verifying  : libIDL-0.8.14-8.el7.x86_64                                                                  5/19 
  Verifying  : gnome-python2-gconf-2.28.1-14.el7.x86_64                                                    6/19 
  Verifying  : gnome-python2-canvas-2.28.1-14.el7.x86_64                                                   7/19 
  Verifying  : python-psutil-2.2.1-1.el7.x86_64                                                            8/19 
  Verifying  : keybinder-0.3.1-1.el7.x86_64                                                                9/19 
  Verifying  : terminator-0.98-3.el7.noarch                                                               10/19 
  Verifying  : python-keybinder-0.3.1-1.el7.x86_64                                                        11/19 
  Verifying  : libbonoboui-2.24.5-7.el7.x86_64                                                            12/19 
  Verifying  : vte-0.28.2-10.el7.x86_64                                                                   13/19 
  Verifying  : gnome-vfs2-2.24.4-14.el7.x86_64                                                            14/19 
  Verifying  : ORBit2-2.14.19-13.el7.x86_64                                                               15/19 
  Verifying  : pyorbit-2.24.0-15.el7.x86_64                                                               16/19 
  Verifying  : gnome-python2-2.28.1-14.el7.x86_64                                                         17/19 
  Verifying  : gnome-python2-bonobo-2.28.1-14.el7.x86_64                                                  18/19 
  Verifying  : libart_lgpl-2.3.21-10.el7.x86_64                                                           19/19 

Installed:
  terminator.noarch 0:0.98-3.el7                                                                                

Dependency Installed:
  ORBit2.x86_64 0:2.14.19-13.el7                         gamin.x86_64 0:0.1.10-16.el7                          
  gnome-python2.x86_64 0:2.28.1-14.el7                   gnome-python2-bonobo.x86_64 0:2.28.1-14.el7           
  gnome-python2-canvas.x86_64 0:2.28.1-14.el7            gnome-python2-gconf.x86_64 0:2.28.1-14.el7            
  gnome-vfs2.x86_64 0:2.24.4-14.el7                      keybinder.x86_64 0:0.3.1-1.el7                        
  libIDL.x86_64 0:0.8.14-8.el7                           libart_lgpl.x86_64 0:2.3.21-10.el7                    
  libbonobo.x86_64 0:2.32.1-7.el7                        libbonoboui.x86_64 0:2.24.5-7.el7                     
  libgnome.x86_64 0:2.32.1-9.el7                         libgnomecanvas.x86_64 0:2.30.3-8.el7                  
  pyorbit.x86_64 0:2.24.0-15.el7                         python-keybinder.x86_64 0:0.3.1-1.el7                 
  python-psutil.x86_64 0:2.2.1-1.el7                     vte.x86_64 0:0.28.2-10.el7                            

Complete!


Install terminator in CentOS 6.5 (64bit)

We installed CentOS 6.5 (64bit) using this ISO, which we downloaded from http://vault.centos.org/6.5/isos/x86_64/

Once we got the OS started, we executed yum update -y to update all installed packages that were older than the versions in the repositories.
After the update process was complete, we then tried to install terminator using yum.

Executing yum install -y terminator resulted in an error:

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.us.leaseweb.net
* extras: mirror.us.leaseweb.net
* updates: mirror.us.leaseweb.net
No package terminator available.
Error: Nothing to do

To solve the problem we needed to install the Extra Packages for Enterprise Linux (EPEL) repository using yum install -y epel-release.

After the installation was done, we executed yum install -y terminator once more and the installation of terminator succeeded.


Downgrade texinfo on CentOS 7.0 (64bit) to version 4.13

Recently we had to download texinfo from version 5.1 to any version less than version 5 series.
We used texinfo version 4.13 which is the latest in the version 4 series.

We were trying to compile some tools using an older version of gcc. Instead of using 4.8.5, we used 4.8.2 to achieve our goal and that caused a problem with some .texi files.

Methodology


#Making sure we are not missing any 32bit libraries since we are on a 64bit machine
yum install glibc.i686 ncurses-libs.i686;
#Download the source code
wget http://ftp.gnu.org/gnu/texinfo/texinfo-4.13.tar.gz;
#Extract the files
tar -zxf texinfo-4.13.tar.gz;
#Navigate to the folder
cd texinfo-4.13;
#Configure the installation and make all necessary checks
./configure;
#Build
make;
#Install
sudo make install;


Downgrade gcc on CentOS 7.0 (64bit) to version 4.8.2

Recently we had to download gcc from version 4.8.5 to 4.8.2.

We were trying to compile some tools and they required using that older version of gcc.
To compile the old version of the gcc we used the version version that was shipped with the distribution.

Methodology

#Making sure we are not missing any 32bit libraries since we are on a 64bit machine
yum install glibc.i686 ncurses-libs.i686;
#Download the source code
wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.gz;
#Extract the files
tar -xvf gcc-4.8.2.tar.gz;
#Navigate to the folder
cd gcc-4.8.2/;
#Make sure we have all dependencies met
./contrib/download_prerequisites;
#Configure the installation and assign the installation folder to be /usr/local/gcc/4.8.2. Finally make all necessary checks before compilation.
./configure --prefix=/usr/local/gcc/4.8.2;
#Build
make;
#Install
sudo make install;

Installing Oracle SQL*Loader on CentOS without full server installation

Assuming you do not want to install the full Oracle suite on the current machine, the following guide will show you how we installed Oracle SQL*Loader on CentOS release 6.7 (Final) using specific packages only. For this tutorial to be successful though, you need to have somewhere the full installation somewhere else as we need to to copy two files from there (the sqlldr executable and the binary file ulus.msb).

On the machine that has the full Oracle suite installation

Execute locate sqlldr to find the location of sqlldr binary file. If it does not return a result use the following:

find / -name "sqlldr" 2>/dev/null

The above command will search for sqlldr in the whole filesystem and it will redirect all errors to /dev/null so that you will not get spammed by access right issues etc.

After you found the file, copy it to the machine you want to use it from, the exact location will be given below.

Then, you need to find ulus.msb using the following command

find / -name "ulus.msb" 2>/dev/null

Copy that file to the machine you want to use sqlldr from as well, the exact location will be given below.

On the machine you want to execute sqlldr from and does not have the full Oracle suite installed

After we get the above files, we need to download the appropriate files from http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html.

To access the files you need to click the Accept License Agreement radio button which means you agree to the ‘OTN Development and Distribution License Agreement for Instant Client‘ and finally you need to be logged in.

To login visit this page https://login.oracle.com/mysso/signon.jsp. If you are not registered yet, you need to create an account with a valid email from here https://profile.oracle.com/myprofile/account/create-account.jspx.

Once you are done with these steps, you need to download two rpm files for the client:

  • oracle-instantclientRELEASE-basic-VERSION.x86_64.rpm
  • oracle-instantclientRELEASE-sqlplus-VERSION.x86_64.rpm
  • oracle-instantclientRELEASE-jdbc-VERSION.x86_64.rpm
  • oracle-instantclientRELEASE-devel-VERSION.x86_64.rpm

The latest version at the time this document was written was version 12.1.0.2.0 and so we downloaded the following files:

Oracle-SQLLOADER

The files were then moved to the server that was to be installed and using an account with administration rights, they were installed using the the rpm -ivh  command:

rpm -ivh oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
rpm -ivh oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
rpm -ivh oracle-instantclient12.1-jdbc-12.1.0.2.0-1.x86_64.rpm
rpm -ivh oracle-instantclient12.1-devel-12.1.0.1.0-1.x86_64.rpm

In case you placed the two rpm files in a folder by themselves you can install both at the same time using the following command which is version independent:

rpm -ivh oracle-instantclient*

The packages will be installed in /usr/lib/oracle/RELEASE. Use ls /usr/lib/oracle/ to find the RELEASE number of your installation (in case you are not sure) and copy the path to client64 folder. In our case it was /usr/lib/oracle/12.1/client64. We will use this path as the ORACLE_HOME variable later on.

Following, you need to setup the environment variables for bash.
If you want to set the environment variables in your account only, add the following in your ~/.bash_profile:

ORACLE_HOME=/usr/lib/oracle/12.1/client64
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_HOME
export LD_LIBRARY_PATH
export PATH

And execute source ~/.bash_profile  to reload your .bash_profile (alternatively, logout and login again).

If you want to set the environment variables for all users, create a .sh file in /etc/profile.d/ (e.g. oracle.sh) and add the content above in that file.

Installing SQL*Loader

Copy the sqlldr executable we got from the other machine to $ORACLE_HOME/bin/ (/usr/lib/oracle/RELEASE/client64/bin/). In our case it was /usr/lib/oracle/12.1/client64/bin/.

Then, copy the ulus.msb binary file to $ORACLE_HOME/rdbms/mesg/ (/usr/lib/oracle/RELEASE/client64/rdbms/mesg/). In our case it was /usr/lib/oracle/12.1/client64/rdbms/mesg/. If the folder does not exist, create it.

Finally, create a text file named tnsnames.ora in $ORACLE_HOME/network/admin/ (/usr/lib/oracle/RELEASE/client64/network/admin/). In our case it was /usr/lib/oracle/12.1/client64/network/admin/. If the folder does not exist, create it.

In tnsnames.ora we need to add the connection information for our databases and name them. The reason we need to do this, is because sqlldr does not accept the connection string from the command line like sqlplus as seen at the end of this tutorial here http://bytefreaks.net/applications/oracle/installing-oracle-sqlplus-on-centos. The structure of the connection string though, is exactly the same as the one used in sqlplus. Following the example from the other guide and the naming convention for the tnsnames.ora file, the format of the string would be:

connectionname=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=HOSTNAME_OR_IP)(PORT=1521))(CONNECT_DATA=(SID=MY_SID)))

SQL*Loader will be available for use using the sqlldr command.

The following example will connect to server with

  • IP 192.168.10.1,
  • on the SID ASID
  • using the user myuser
  • the password pass
  • and we will use the control file profitLoader.ctl  to configure what the program will do once it starts (profitLoader.ctl is a file we wrote that describes the structure of the input file and the table to which the data should be added, code below for reference)

In tnsnames.ora file will add the following line:

myconnection=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.1)(PORT=1521))(CONNECT_DATA=(SID=ASID)))"

and we will use the connection information as follows:

sqlldr "username[alias][email protected]" control=profitLoader.ctl;

In our example we do not have an alias, so we will remove the [] part and use the rest. the command will be formed as follows:

sqlldr "[email protected]" control=profitLoader.ctl;

The content of profitLoader.ctl is as follows:

LOAD DATA
INFILE '/dev/shm/profitLoader.dat'
APPEND INTO TABLE PROFIT
FIELDS TERMINATED BY ','
(USERID, TRANSACTIONID, PROFIT)

In our scenario, we have a csv file that contains 3 columns and we want to load all the data to a table called PROFIT.