Automating Oracle Linux Installation with Kickstart
Kickstart ?
If you need to setup from scratch several Oracle Linux systems for your Oracle databases, it can be boring to repeat the install tasks again and again on each servers.
Automation and standardization are the keys.
Kickstart can provide an easy way to accomplish mass deployment.
Kickstart configuration files
Kickstart will use a Kickstart configuration file to perform the deployment.
Maintaining ready to go Kickstart configurations is easy.
We will use in our demo an ftp server to store and access our configuration file.
Lets go !
Fisrt install an ftp server
On an oralinux 7.2 server, just type following command to install an ftp server + an ftp client
yum install vsftpd ftp lftp |
Then adapt timeout parameter to avoid disconnection when deploying your server.
Be sure anonymous access is enable.
[root@localhost ~] # sed '/^#/d' /etc/vsftpd/vsftpd.conf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | anonymous_enable=YES local_enable=YES write_enable=YES local_umask=022 dirmessage_enable=YES xferlog_enable=YES connect_from_port_20=YES xferlog_std_format=YES idle_session_timeout=6000 data_connection_timeout=1200 listen=NO listen_ipv6=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES |
and start your ftpd server.
1 | systemctl start vsftpd |
Then put your kickstart configuration file in it. i will explain the file later:
1 | vi /var/ftp/pub/myksfile .ks |
And copy/paste the whole content. I will explain the file later:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | ######################################################################## ######################################################################## ## ## ## Kickstart for OEL7 : olg.dbi-services.com ## ## ## ######################################################################## ######################################################################## # install through HTTP ######################################################################## install cdrom # locale settings ######################################################################## lang en_US.UTF-8 keyboard --vckeymap=ch --xlayouts= 'ch' timezone --utc Europe /Zurich # X is not configured on the installed system. ######################################################################## skipx # installation mode ######################################################################## text reboot -- eject # Partition table initialization ######################################################################## zerombr # Network configuration # Oracle Linux 7: How to modify Network Interface names (Doc ID 2080965.1) ######################################################################## ### network --device eth0 --bootproto static --ip 192.168.56.102 --netmask 255.255.255.0 --gateway 192.168.56.1 --nameserver it.dbi-services.com --hostname olg.dbi-services.com net.ifnames=0 # security settings ######################################################################## rootpw toor firewall --enabled -- ssh selinux --enforcing authconfig --enableshadow --passalgo=sha512 # Partitioning and bootloader ######################################################################## # only 1 disk presented to the O.S during installation time # net.ifnames=0 to use eth name for network devices bootloader --location=mbr --append= "nofb quiet splash=quiet crashkernel=auto net.ifnames=0" firstboot --disable clearpart --all --initlabel part /boot --fstype xfs --ondisk= /dev/sda --size=512 part swap --size=2048 --ondisk= /dev/sda part pv.01 --size=100 --ondisk= /dev/sda --grow volgroup RHELVG pv.01 logvol / --fstype xfs --name=RootLV --vgname=RHELVG --size=8196 logvol /usr --fstype xfs --name=UsrLV --vgname=RHELVG --size=2048 logvol /tmp --fstype xfs --name=TmpLV --vgname=RHELVG --size=2048 logvol /var --fstype xfs --name=VarLV --vgname=RHELVG --size=4096 logvol /var/log/audit --fstype xfs --name=AuditLV --vgname=RHELVG --size=2048 logvol /opt --fstype xfs --name=OptLV --vgname=RHELVG --size=2048 logvol /home --fstype xfs --name=HomeLV --vgname=RHELVG --size=2048 logvol /u01 --fstype xfs --name=u01LV --vgname=RHELVG --size=2048 # packages + RPMs ######################################################################## %packages @base # system components device-mapper-multipath kexec-tools lvm2 e4fsprogs sg3_utils lsscsi dstat ntp perl postfix bc # VI vim-common vim-enhanced # SELINUX setroubleshoot setroubleshoot-server setroubleshoot-plugins %end # POST installations tasks ######################################################################## %post modprobe --first- time bonding # VLAN kernel module # modprobe --first-time 8021q # configure bond ################ echo "DEVICE=bond0 TYPE=Bond BONDING_MASTER= yes BOOTPROTO=static IPADDR=192.168.56.149 NETMASK=255.255.255.0 GATEWAY=192.168.56.1 BONDING_OPTS=\"mode=active-backup miimon=100\" ONPARENT= yes ONBOOT= yes " > /etc/sysconfig/network-scripts/ifcfg-bond0 echo "DEVICE=eth0 ONBOOT= yes MASTER=bond0 BOOTPROTO=none NM_CONTROLLED=no SLAVE= yes " > /etc/sysconfig/network-scripts/ifcfg-eth0 echo "DEVICE=eth1 ONBOOT= yes MASTER=bond0 BOOTPROTO=none NM_CONTROLLED=no SLAVE= yes " > /etc/sysconfig/network-scripts/ifcfg-eth1 echo "DEVICE=eth2 ONBOOT= yes BOOTPROTO=dhcp NM_CONTROLLED=no " > /etc/sysconfig/network-scripts/ifcfg-eth2 rm -f /etc/sysconfig/network-scripts/ifcfg-en * systemctl restart network systemctl stop NetworkManager.service systemctl disable NetworkManager.service # Switch to Postfix ################### alternatives -- set mta /usr/sbin/sendmail .postfix # HOSTS FILE ############ cat >> /etc/hosts <> /etc/ntp .conf # DNS config ############# cat > /etc/resolv .conf < /etc/postfix/main .cf < /etc/postfix/master .cf <> /etc/postfix/generic postmap /etc/postfix/generic # user management + SUDO privilege delegation ######################################################################## adduser admora echo toor | passwd admora --stdin echo "admora ALL=NOPASSWD: ALL #admora ALL = NOPASSWD: /bin/su - oracle , /bin/su -" >> /etc/sudoers # Enable services ######################################################################## systemctl enable ntpd.service systemctl start ntpd.service systemctl enable ntpdate.service # Oracle +Nagios prereqs ######################################################################## yum -y install oracle-rdbms-server-11gR2-preinstall oracle-rdbms-server-12cR1-preinstall oracle-database-server-12cR2-preinstall yum -y install openssl openssl-devel yum -y install net-tools # as of ALUA RHEL7.4 incompatibilities (stay on 7.2 and lock repo. later) #yum -y update # Oracle tuned configuration ######################################################################## mkdir -p /usr/lib/tuned/dbiOracle cat > /usr/lib/tuned/dbiOracle/tuned .conf < /sys/class/fc_host/host1/issue_lip echo 1 > /sys/class/fc_host/host2/issue_lip echo " # Format: # alias wwid # LUN_ORAFRA 360030d90466abf0660191bde985bba15 LUN_ORADBF 360030d906382c2065827918ddb6506da" >> /etc/multipath/bindings cat > /etc/multipath .conf <<EOF defaults { polling_interval 60 } blacklist { devnode "^sd[a]" devnode "^(zram|ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" devnode "^hd[a-z]" devnode "^cciss!c[0-9]d[0-9]*" } blacklist_exceptions { wwid "360030d90466abf0660191bde985bba15" wwid "360030d906382c2065827918ddb6506da" #vendor "DataCore" #product "Virtual Disk" } devices { device { vendor "DataCore" product "Virtual Disk" path_checker tur prio alua failback 10 no_path_retry fail dev_loss_tmo infinity fast_io_fail_tmo 5 rr_min_io_rq 100 # Alternative option – See notes below # rr_min_io 100 path_grouping_policy group_by_prio # Alternative policy - See notes below # path_grouping_policy failover # optional - See notes below user_friendly_names yes } } EOF systemctl reload multipathd # final post steps (Bugs, security) #################################### systemctl disable rdma.service touch /.autorelabel dracut -f %end |
Test that you can access anonymously to your file through ftp with your browser
ftp://192.168.56.101/pub/myksfile.ks
Or via an ftp client
$ lftp ftp : //192 .168.56.101 |
1 | lftp 192.168.56.101:~> cat /pub/myksfile .ks |
You can now deploy your Oracle Linux server for a new database:
When you arrive on the installation screen,
Booting from dvd, press ESC to get the boot prompt and type
For the demo, I’m using Virtual Box VM, + 1 dvd drive for the ISO file i have downloaded from the oracle site: V100082-01.iso (oralinux7.2)
1 | linux ks= ftp : //192 .168.56.101 /pub/myksfile .ks |
Then press ENTER as shown in this demo:
Here, if you don’t get RNETLINK answers: File exists, something is wrong in your network configuration.
At this step, if you see the green line, it’s mean you entered in anaconda and that your installation process is ongoing.
If you receive some Pane errors, once again, something is wrong in the network configuration. This is the hard part. Depending of the customer infrastructure, you could need to set up ip manually.
Below 2 examples: one using a static IP configuration and the other a VLAN configuration.
static IP configuration |
1 | linux ip=192.168.56.102 netmask=255.255.255.0 gateway=192.168.56.1 servername=it.dbi-services.com ks= ftp : //192 .168.56.101 /pub/myksfile .ks net.ifnames=0 |
static IP configuration with use of VLAN (VLANID=27 in this example) |
1 | linux ip=192.168.56.102 netmask=255.255.255.128 gateway=192.168.56.1 servername=it.dbi-services.com ks= ftp : //192 .168.56.1 /myksfile .ks net.ifnames=0 vlan=VLAN27.27:eth0 |
Anaconda will now perform the partitioning part:
For the demo, I’m using a 40G disk. If you don’t give enough space, or if you have done some errors in your configuration, you will be prompt to fix the configuration issues. You would better restart the installation from the beginning.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | # Partitioning and bootloader ######################################################################## # only 1 disk presented to the O.S during installation time # net.ifnames=0 to use eth name for network devices bootloader --location=mbr --append= "nofb quiet splash=quiet crashkernel=auto net.ifnames=0" firstboot --disable clearpart --all --initlabel part /boot --fstype xfs --ondisk= /dev/sda --size=512 part swap --size=2048 --ondisk= /dev/sda part pv.01 --size=100 --ondisk= /dev/sda --grow volgroup RHELVG pv.01 logvol / --fstype xfs --name=RootLV --vgname=RHELVG --size=8196 logvol /usr --fstype xfs --name=UsrLV --vgname=RHELVG --size=2048 logvol /tmp --fstype xfs --name=TmpLV --vgname=RHELVG --size=2048 logvol /var --fstype xfs --name=VarLV --vgname=RHELVG --size=4096 logvol /var/log/audit --fstype xfs --name=AuditLV --vgname=RHELVG --size=2048 logvol /opt --fstype xfs --name=OptLV --vgname=RHELVG --size=2048 logvol /home --fstype xfs --name=HomeLV --vgname=RHELVG --size=2048 logvol /u01 --fstype xfs --name=u01LV --vgname=RHELVG --size=2048 |
When the partitioning part is finish, the package installation process will begin.
You can add personalize the packages you want install from the dvd.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | # packages + RPMs ######################################################################## %packages @base # system components device-mapper-multipath kexec-tools lvm2 e4fsprogs sg3_utils lsscsi dstat ntp perl postfix bc |
During the installation, you can TAB between console to get more information on what’s going on.
Console 2 permit you to type shell commands:
For the demo, I’m using 3 Ethernet cards: 2 for the bonding, 1 NAT for internet connection.
With ip a command, i can see which the interface names and IP i’m currently using during the installation process:
Because I set net.ifnames=0, eth will be used after rebooting for my netcard interfaces name. I will configure them in the POST installations tasks.
56 | bootloader --location=mbr --append="nofb quiet splash=quiet crashkernel=auto net.ifnames=0 |
Switching between Console 1 / Console 3 / Console 5 permit to see what anaconda is doing. Interesting part it the %%post message.
It means you are in the POST installations tasks.
Configuration files of your system can be modified.
In my demo, i will configure bonding, postfix, multipathing + yum install oracle-database-server-12cR2-preinstall package with dependencies !
The script coming from the kickstart configuration file is stored in the /tmp folders. It is called /tmp/ks-script-JeYnWI.log in my demo.
After reboot, you can inspect it if you like to.