Install CentOS 7, Oracle XE and other development tools
The CentOS distribution is a famous and stable Linux version derived from RedHat Linux. It’s been one of my favorites and one that you can easily find with hosting providers.
In this article we will install CentOS and OracleXE. It’s worth mentioning the OS team improves the installation process with each version, and you will find out in this tutorial how straightforward it currently is.
1. Installing CentOS
We’ll perform a minimal installation
; this means, we will not install a graphical interface, because this server is meant to be a web / database test server.
Boot your computer with the installation disk in it.
Login. At this point, I recommend you to update the system. There are many packages that have changed since the CentOS developers created the installation package. So make sure the internet cable is plugged in and type the following command:
yum update
The number of updates will greatly vary depending on the date. Restart your system when the process is done:
shutdown -r now
2. Installing Additional Packages
During the OracleXE installation process you will need the following packages. So go ahead and install them:
yum install unzip
yum install libaio bc flex
3. Installing Oracle XE Database
Download Oracle XE from the official website.
Once downloaded, type the following commands:
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
cd Disk1
rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
the installation program will begin:
Preparing... ################################# [100%]
Updating / installing...
1:oracle-xe-11.2.0-1.0 ################################# [100%]
Executing post-install steps...
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.
Ready!, now it’s time to configure it. Type the following command and respond to the questions:
/etc/init.d/oracle-xe configure
Sample output:
Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express
Edition. The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts. Press <Enter> to accept the defaults.
Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application Express [8080]:8080
Specify a port that will be used for the database listener [1521]:1521
Specify a password to be used for database accounts. Note that the same
password will be used for SYS and SYSTEM. Oracle recommends the use of
different passwords for each database account. This can be done after
initial configuration:
Confirm the password:
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y
Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
At this point you have an OracleXE instance running and should now be able to connect to it from SQL Developer or any other client… Talking about clients, let’s install a local client.
4. Oracle Instant Client
In this step we will install SQL Plus.
Download the following packages from the (Oracle website)[http://www.oracle.com/technetwork/topics/linuxx86–64soft–092277.html]
- oracle-instantclient12.1-basic–12.1.0.2.0–1.x86_64.rpm
- oracle-instantclient12.1-sqlplus–12.1.0.2.0–1.x86_64.rpm
Install the files:
yum localinstall oracle-instantclient* --nogpgcheck
Create a directory to keep your TNS files and set ownership to your regular user to it:
mkdir /usr/lib/oracle/12.1/client64/network/admin -p
chown username /usr/lib/oracle/12.1/client64/network/admin
Add any TNS files to the given directory (don’t worry if you don’t have any).
The final step is to add environment vars to your .bash_profile:
vi /home/username/.bash_profile
Add the following lines at the end of the file:
# Oracle variables
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin
Logout and login as a non-administrative user so all the changes to .bash_profile
are applied.
The moment of glory has arrived. Type the following command to test your system:
sqlplus system/password@localhost
5. Enable remote connectivity
SQL Developer allows you to create remote connections thru SSH. My recommendation: do it this way. Do not open any other port. It works.
6. Troubleshooting
If something didn’t go right, verify what Oracle packages are installed by typing the following command:
rpm -qa | grep oracle
You should see something like this:
oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64
oracle-xe-11.2.0-1.0.x86_64
oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64
7. Additional Stuff
Since we’re installing a test server, here are some other tools you might find useful.
7.1 The EPEL Repository
Great source of software.
Download it from the (Fedora Project Website)[http://dl.fedoraproject.org/pub/epel/7/x86_64/repoview/epel-release.html] and install it:
rpm -ivh epel-release-7-5.noarch.rpm
To verify the EPEL repository is there, type:
yum repolist
you should see it in the list.
7.2 The Remi Repository
Another great resource. Download it and install it this way:
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm
Edit the configuration file:
vi /etc/yum.repos.d/remi.repo
And manually enable it:
enabled=1
To verify the Remi repository is there, type:
yum repolist
you should see it in the list.
7.3 ifconfig
ifconfig
is one of those tools that I find really useful. However the minimal installation does not provide it. So you have two options to go from here, wether you can look for it:
yum whatprovides ifconfig
and install it
yum install net-tools
or do not install it and use the ip
command to check your network configuration:
ip addr
7.4 Other Development Tools
I really recommend you to get them. Some packages need local compilation, so you’re going to use them:
yum install libtool gcc gcc-c++ libstdc++-devel libstdc++-docs make automake
yum install boost boost-devel boost-doc
7.5 Doxygen
If you value the power of code documentation, you want this:
yum install doxygen graphviz graphviz-devel graphviz-doc
7.6 Java 1.8
A computer cannot be complete without a Java compiler… well, at least for me. Download the latest JDK from the Oracle website and install it.
rpm -ivh jdk-8u25-linux-x64.rpm
Test by typing:
java -version
I really hope you find this tutorial useful. Please share with otters 😉