Install Oracle Database 12.1 and PostgreSQL 9.4 + PostGIS on Oracle Linux 7.4

Hey everyone,

I had to install an Oracle Linux 7.4 Server with a running Oracle Database 12.1 and PostgreSQL 9.4 + PostGIS. I will share my steps below.

 

Install Oracle Linux 7.4

  • Select “Agent for Hypervisor” during installation

 

[Optional if previous step is done] Install VMWareTools

  • From vSphere client mount source
  • From VM
# mount /dev/cdrom /mnt 
# cp /mnt/VMwareTools-8.6.17-3814316.tar.gz /tmp 
# tar -xvzf /mnt/VMwareTools-8.6.17-3814316.tar.gz 
# cd /tmp/vmware-tools-distrib/ 
# ./vmware-install.pl

 

Configure Network settings

# ip addr add 192.168.100.43/17 dev ens160 
# route add default gw 192.168.100.160 ens160 
# vi /etc/resolv.conf add  "nameserver 192.168.100.125 nameserver 192.168.100.128" 
# vi /etc/hosts add "192.168.100.43   servername.localdomain"

 

Update Yum and install Oracle Prerequisites

# yum update 
# yum install oracle-rdbms-server-12cR1-preinstall.x86_64

 

Set “oracle” account password

# passwd oracle

 

Set secure Linux to permissive

By editing the “/etc/selinux/config” file, making sure the SELINUX flag is set as follows “SELINUX=permissive

Once the change is complete, restart the server or run the following command

# setenforce permissive

 

Disable (or configure) firewall

# systemctl stop firewalld 
# systemctl disable firewalld

 

Add new Disk for Oracle Data from vSphere client

Reboot the VM or rescan SCSI bus manually

# echo "- - -" > /sys/class/scsi_host/host#/scan

Replace “#” by “0”,”1″, … Can be found by running

# ls /sys/class/scsi_host

Then check if the new Disk is visible

# fdisk -l

 

Create a new partition and format it

# fdisk /dev/sdb

Select option “n” select “w” to write changes and exit

# mkfs.ext4 /dev/sdb1

 

Edit fstab

# vi /etc/fstab

Add “/dev/sdb1       /u01    ext4    defaults        1 2

 

Create “u01” directory, mount the new partition, create sub-folders structure and modify permissions and ownership

# mkdir u01 
# mount -a 
# mkdir -p /u01/app/oracle/product/12.1.0.2/db_1 
# chown -R oracle:oinstall /u01 
# chmod -R 775 /u01

 

Edit “/home/oracle/.bash_profile” file

# vi /home/oracle/.bash_profile

Add the following at the end of the file

# Oracle Settings

export TMP=/tmp 
export TMPDIR=$TMP
export ORACLE_HOSTNAME=servername.localdomain 
export ORACLE_UNQNAME=orcl 
export ORACLE_BASE=/u01/app/oracle 
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/db_1 
export ORACLE_SID=orcl
export PATH=/usr/sbin:$PATH 
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib 
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

Note : For the following steps to work, Xming should be installed and running. Putty should be configured to “Enable X11 Forwarding” and you have to login with oracle user directly from Putty
Upload “linuxamd64_12102_database_1of2.zip” and  linuxamd64_12102_database_2of2.zip” to /tmp

 

Unzip the files

# cd /tmp 
# unzip linuxamd64_12102_database_1of2.zip 
# unzip linuxamd64_12102_database_2of2.zip

 

Install Oracle Database 12.1.02

# cd database
# ./runInstaller

 

Note : EM Url become https://servername.localdomain:5500/em

 

Set automatic DB startup for ORCL instance  

# vi /etc/oratab

Switch the “N” value to “Y” “orcl:/u01/app/oracle/product/12.1.0.2/db_1:Y

 

 

PostgreSQL install will come later.

Temp source: gokhanatil.com

 

 

 

 

Advertisements

Install VMWare Tools on Linux VM using open-vm-tools

Hello everyone,

 

This article will show how to install VMWare Tools on a Linux VM. For this example, I’ll do it on a Debian/Ubuntu & CentOs Distributions.

First thing to know is you can install VMWare Tools as you do on a Windows VM by Right-Clicking the VM – Guest – Install/Upgrade VMWare Tools. VMWare already has a good article on HowTo do it here.

But ! VMWare itself recommends installing 3rd Party OS VM Tools Package named “open-vm-tools” so I’ll go ahead with is installation which is easier and faster than installing VMWare’s own tools from vSphere Client.

For Debian/Ubuntu :

  • Log on to your Server as root and update apt-get
apt-get update
  • Install “open-vm-tools”
apt-get install open-vm-tools

 

For CentOs :

Depending on your CentOs version, you should be or not be able to install the package instantly from the default Repo if you have one of the latest version, here 7.2. If earlier version, maybe you will need to add a Repo.

  • Install “open-vm-tools”
yum install open-vm-tools
  • Start the service
service vmtoolsd start

 

Done. Hope this helps.

 

Install Apache Reverse Proxy on Ubuntu Server

Hello everyone,

I am going to implement an Apache Reverse Proxy on Ubuntu Server. I will share with you the steps I did to accomplish this task.

 

  • Install Ubuntu Server

I will not explain how to install Ubuntu Server as it’s straight forward and easy. For your information I used the 16.04.2 version and did a basic install without LAMP.

 

  • Install Apache

First of all, run :

sudo apt-get update

sudo apt-get upgrade

To make sure all of your packages are up to date. Then install Apache, here Ubuntu version 2.4.18 :

sudo apt-get install apache2

Check that Apache is now properly running and available by opening up your browser and surf to your server’s IP or run :

service apache2 status

 

  • Configure Apache

To work as a Proxy,  Apache needs some modules enabled. To enable a module, you can run :

a2enmod

It will show you all available modules you can enable. We will go ahead with the following ones :

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_ajp
sudo a2enmod rewrite
sudo a2enmod deflate
sudo a2enmod headers
sudo a2enmod proxy_balancer
sudo a2enmod proxy_connect
sudo a2enmod proxy_html

We will then need to disable Apache default configuration file 000-default.conf and create a new one inside the /etc/apache2/sites-available directory.

To disable it, run :

sudo a2dissite 000-default

Then create the new file :

sudo nano /etc/apache2/sites-available/reverse-proxy.conf

Note : you need to name it .conf or “a2ensite” will not find it when trying to enable it later.

Add your VirtualHost in this file to match your Reverse-Proxy preferences. Here is mine, you can tweak it :

<VirtualHost *:80>
 ServerName localhost
 DocumentRoot /var/www/html
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined
 <Location />
 Require all denied
 </Location>
</VirtualHost>

<VirtualHost *:80>
 ServerName server1.domain.com
 ServerAdmin admin@domain.com
 DocumentRoot /var/www/html
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined
 ProxyPass / http://srv1.domain.com/
 ProxyPassReverse / http://srv1.domain.com
# ProxyPreserveHost On
</VirtualHost>

<VirtualHost *:80>
 ServerName server2.domain.com
 ServerAdmin admin@domain.com
 DocumentRoot /var/www/html
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined
 ProxyPass / http://srv2.domain.com/
 ProxyPassReverse / http://srv2.domain.com
# ProxyPreserveHost On
</VirtualHost>

 

The first VirtualHost will just deny the access to the default website if the others two are not match when checking the ServerName directive.

If you browse to server1.domain.com, it will forward requests to server srv1.domain.com and if you browse to server2.domain.com, it will forward requests to srv2.domain.com.

If you browse using the IP address or another subdomain pointing to your Proxy server, you will get the access denied webpage from the first VirtualHost.

I suggest you to read the great document on Apache’s website for more information on how Apache handle incoming requests, their orders and whats Directives your can use.

Here is the doc followed by some examples :

https://httpd.apache.org/docs/2.4/vhosts/index.html

https://httpd.apache.org/docs/2.4/vhosts/examples.html

 

Now, enable your new configuration file :

sudo a2ensite reverse-proxy

And finally, restart Apache :

sudo service apache2 restart

 

Your Proxy server should now work. IE.: as said above, browsing to server1.domain.com should redirect you to the app hosted on srv1.domain.com

 

 

Linux – Mount network share

Article/credits from: linhost.info

Create Mount Point

For every network share you wish to mount you need to specify a mount point just like we do with hard drives and USB drives. I would recommend creating the mount point in the /mnt directory.

mkdir /mnt/shares/share1

Install Cifs-util Suite

If the system you are working with lacks the cifs-util it can be installed using the package manager for your distribution.

Ubuntu and Debian users can use apt-get.

apt-get install cifs-utils

Scientific Linux and CentOS users can use yum.

yum install cifs-utils

Mount Network Share With Credentials

The basic command below will attempt to mount a network share with credentials, in this case the file server is a Windows Server 2003 and the client is a Ubuntu 12.04 server.

mount.cifs //192.168.1.107/share1/  /mnt/shares/share1/ -o user=user1,pass=user1password

Description:

  • mount.cifs – Mount using the CIFS
  • //192.168.1.107/share1/ – IP address or name of file server followed by the share name
  • /mnt/shares/share1/ – This is the mount point where our network share will reside
  • -o users=user1,password=user1 – This means options and in my case I am specifying the username and password to the share

Mount Public Share

To mount a public share or one that doesn’t require a password is even easier. All you are required to specify is the server IP address, share and mount point.

mount.cifs //192.168.1.107/share1/  /mnt/shares/share1/
  • mount.cifs – Mount using the CIFS
  • //192.168.1.107/share1/ – IP address or name of file server followed by share name
  • /mnt/shares/share1/ – This is the mount point where our network share will reside

Mount Share At Boot

Now that was easy, keep in mind that using the commands above will only result in the network shares being temporarily mounted, if the system were to be rebooted all mounted shares will be unmounted. If you would like to keep the network shares mounted even after a reboot you can acomplish this with the help of the fstab configuration file.

Add the following line to the bottom of your fstab configuration file. Modify to fit your needs.

//192.168.1.129/share1  /mnt/shares/share1  cifs  username=user1,password=user1password  0  0