Saturday, January 16, 2021

MySQL 8 installation using binary distribution on Oracle Enterprise Linux 7 (OEL 7)

Most Oracle Enterprise Linux (OEL) operating systems may already be having an existing MySQL installation. It is important that any existing MySQL server process be terminated before attempting to start the MySQL server process from a new installation.

Also, one should update the PATH environment variable to refer to the new installation's bin folder before performing the new MySQL server administration.

1) Login as root

2) ps -ef | grep mysqld

If you find an existing mysqld process already running (For example /usr/libexec/mysqld) , then terminate it using the kill command.

3) Download mysql-8.0.22-el7-x86_64.tar.gz binary distribution from https://dev.mysql.com/downloads/mysql/5.5.html?os=31

4) Copy mysql-8.0.22-el7-x86_64.tar.gz to /usr/local

5) Create a mysql operating system user and assign it an operating system group called mysql (If not already present). The /bin/false option will prevent mysql operating system user from interactive login to the Linux operating system.

groupadd mysql useradd -r -g mysql -s /bin/false mysql

6) cd /usr/local

7) gunzip mysql-8.0.22-el7-x86_64.tar.gz

8) tar -xvf mysql-8.0.22-el7-x86_64.tar

9) ln -s mysql-8.0.22-el7-x86_64.tar mysql

10) cd mysql

11) mkdir mysql-files

12) chown mysql:mysql mysql-files

13) chmod 750 mysql-files

14) bin/mysqld --initialize --user=mysql

The initialize command initializes the data directory. MySQL uses /var/lib/mysql directory as default data directory for Linux based systems.

Note the password from the message "A temporary password is generated for root@localhost:"

15) bin/mysql_ssl_rsa_setup

16) bin/mysqld_safe --user=mysql &

Change the default password of the root superuser account.

17) export PATH=/usr/local/mysql/bin:$PATH (Make this PATH environment variable setting permanent so that subsequent logins as root operating system user automatically sets it this way).


18) which mysql (Must show it as /usr/local/mysql/bin/mysql


19) mysql -u root -p -h localhost




20) alter user 'root'@'localhost' identified by 'mysql';



Saturday, January 2, 2021

Oracle 19c installation on Oracle Linux 7 in Amazon AWS EC2 instance

This article provides all the details on how to install Oracle 19c database software on Oracle Enterprise Linux (OEL) 7 in an Amazon AWS EC2 instance. Additionally, the installation option chosen below creates a starter Oracle 19c database as well.

Note: For easier identification purposes, all Operating system (OS) commands and Oracle database commands that are to be executed in the Linux server are shown in Orange color in Bold.

Create an Oracle Linux server in AWS

https://aws.amazon.com/

 

Note: You can skip the below AWS account creation process if you already have an existing account.

  

 

 

https://console.aws.amazon.com/

 

 

Enter ami-00cf6ad74f988f94b in the top left-hand corner.

Note: You can choose an existing key pair if you already have one.

 


 

 

 

 

 

Elastic IP addresses

 

An Elastic IP address is a static IPv4 address designed for dynamic cloud computing. An Elastic IP address is associated with only one server at any given time in your AWS account. An Elastic IP address is a public IPv4 address, which is reachable from the internet.

 


 

 

Install Productivity software tools in your PC

TigerVNC Viewer (Windows PC only)

https://bintray.com/tigervnc/stable/tigervnc/1.10.0

Chicken VNC (MAC computers only)

MAC Operating System requires a separate tool called “Chicken VNC”.

http://sourceforge.net/projects/cotvnc/  and Download it

MobaXterm

https://mobaxterm.mobatek.net/

Add recommended packages and the Oracle 19c package in the Oracle Linux server

 

Please login to the Oracle Linux server using MobaXterm with user name ec2-user and port 22

 

sudo su - root

 

cat /etc/oracle-release

yum install oracle-database-preinstall-19c

yum install vnc

yum install vnc-server

yum install xterm

yum groupinstall "X Window System"

yum install kdebase

yum install gnome-terminal

yum groupinstall "KDE"

yum install unzip

yum install zip

yum groupinstall fonts

yum update

 

usermod -g dba oracle (The RPM oracle-database-preinstall-19c already creates the oracle operating system user with oinstall as the default group. This command changes the default group to dba)

 

rm -rf  /tmp/.X11-unix/

cd  /lib/systemd/system

Make a copy of vncserver@.service

Edit vncserver@.service and replace <USER>  with oracle. Leave the remaining lines of the file unmodified.

 

systemctl  daemon-reload

systemctl  enable  vncserver@:1.service

systemctl  start  vncserver@:1.service

 

Edit /etc/rc.d/rc.local and add the line service iptables restart

 

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

service iptables restart

 

sudo su - oracle 

vncpasswd (Enter oracle as the password)

 

export DISPLAY=:1.0

xhost +

 

exit

passwd root (Enter oracle as the root password)

 

cd /etc/sysconfig

cp iptables iptables.backup

 

Edit iptables and edit the dports line as shown below

 

-A INPUT -p tcp -m state --state NEW -m tcp -m multiport --dports 22,5901 -j ACCEPT

 

        

 

Add 4 GB Swap space

 

dd if=/dev/zero of=/swapfile1 bs=1024 count=4194304

chown root:root /swapfile1

chmod 0600 /swapfile1

mkswap /swapfile1

swapon /swapfile1

 

Edit /etc/fstab and add the line shown below

/swapfile1 none swap sw 0 0

free -m  (The swapsize must be shown as 4GB now)

 

Stop and Start the instance (server) in AWS console

 

 

 

 

 

Download Oracle 19c database software to your PC

https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html

Download LINUX.X64_193000_db_home.zip

 


 

Downloading Oracle software requires a new Oracle account. A free account can be created in a few minutes.

 

Login to the Oracle server using TigerVNC Viewer

Open a new terminal

su – root (If prompted for password, enter oracle)

Create the inventory location

cd /etc

vi oraInst.loc  (Letter I in CAPITALS)

Add the below lines in the oraInst.loc file

inventory_loc=/var/opt/oracle/oraInventory

inst_group=dba

 

 mkdir -p /var/opt/oracle

chown -R oracle:dba /var/opt/oracle

 mkdir -p /u01/app/oracle

mkdir -p /u01/app/oraInventory

chown -R oracle:dba /u01/app/oracle

chown -R oracle:dba /u01/app/oraInventory

chmod -R 775 /u01/app

sudo su - oracle

mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1

cd /u01/app/oracle/product/19.0.0/dbhome_1

 

Note: Transfer this software zip file LINUX.X64_193000_db_home.zip to the /u01/app/oracle/product/19.0.0/dbhome_1 directory in Oracle server using MobaXterm’s SFTP session.

 Now come back to the Terminal inside the Linux server

ls -lrt LINUX.X64_193000_db_home.zip (This zip file must be owned by oracle:dba. Otherwise change the ownership by running chown oracle:dba LINUX.X64_193000_db_home.zip as root operating system user)

echo $USER  (Must show oracle)

unzip LINUX.X64_193000_db_home.zip

Setup software and create an Oracle 19c database

 Login to the Oracle server using TigerVNC Viewer

Open a new terminal

echo $USER  (Must show oracle)

export DISPLAY=:1.0

xhost +

 

cd /var/opt/oracle

mkdir oraInventory  (Let us create the inventory location for the Oracle installation log file.)

cd /u01/app/oracle/product/19.0.0/dbhome_1

./runInstaller  (Letter I in CAPITALS)

 


Close the Linux terminal

Open a new Linux terminal

 .  oraenv (DOT followed by a whitespace followed by oraenv)

Enter the values shown in the below screenshot

 

Validation of Oracle database creation

 

select name from v$database; (Must show ORCL)

select status from v$instance; (Must shown OPEN)

 

select file_name from dba_data_files;

select tablespace_name from dba_tablespaces;

exit

 



Related Posts Plugin for WordPress, Blogger...