Skip to content

Instantly share code, notes, and snippets.

@mortenbra
mortenbra / centos_update.sh
Last active August 29, 2015 14:22
Update CentOS packages via yum
# check what updates are available
yum check-update
# update everything
yum update -y
# update everything except the kernel
#yum update -y --exclude=kernel*
@mortenbra
mortenbra / centos_firewall.sh
Last active January 10, 2023 02:41
Basic firewall (iptables) script for CentOS with openings for SSH, HTTP and HTTPS
#!/bin/bash
# see http://oracle-base.com/articles/linux/linux-firewall.php
# Set the default policies to allow everything while we set up new rules
# Prevents cutting yourself off when running from remote SSH
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
@mortenbra
mortenbra / oracle_upload_software.sh
Last active August 31, 2015 13:44
Copy Oracle installation files from client to server using SCP
# copy files from client to server
# assumes you have downloaded everything into an "install" folder
# adjust SSH port number, file paths, server/host name and version numbers as appropriate
cd /users/yourname/install/oracle
scp -P 22 oracle-xe-11.2.0-1.0.x86_64.rpm.zip root@server-name-or-ip:/u01/download/
scp -P 22 apex_5.0.1_en.zip root@server-name-or-ip:/u01/download/
scp -P 22 jdk-7u79-linux-x64.rpm root@server-name-or-ip:/u01/download/
scp -P 22 ords.2.0.10.289.08.09.zip root@server-name-or-ip:/u01/download/
@mortenbra
mortenbra / xe_install.sh
Last active August 29, 2015 14:22
Install Oracle XE on CentOS
# install Oracle XE 11g on CentOS
# assumes the installation file has already been copied to /u01/download
# create Oracle user and groups
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba,oinstall oracle
chown -R oracle:oinstall /u01
@mortenbra
mortenbra / oracle_sqlplus_env.sh
Created June 6, 2015 13:06
Add Oracle environment variables to bash profile in CentOS
# setup Oracle environment in bash profile to be able to access sqlplus from anywhere
# http://stackoverflow.com/questions/16823591/how-to-add-lines-to-end-of-file-linux
# this adds the Oracle environment variables to the "oracle" user, but you may also want to add it to root or any other users
echo '. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh' >> /home/oracle/.bash_profile
@mortenbra
mortenbra / centos_hosts_file
Last active February 22, 2025 16:38
Sample /etc/hosts file for CentOS
# sample /etc/hosts file
# see http://unix.stackexchange.com/questions/13046/format-of-etc-hosts-on-linux-different-from-windows
# IPv4
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
# IPv6
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# put your IP address and your hostname and aliases below
1.2.3.4 myserver.mydomain.example myserver
@mortenbra
mortenbra / tomcat_service_script
Last active June 27, 2019 07:36
Tomcat script to start, stop and restart service on CentOS (save this as "tomcat" under /etc/init.d/)
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/usr/java/latest
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/tomcat7/latest
@mortenbra
mortenbra / tomcat_connector.xml
Last active August 29, 2015 14:22
Regular HTTP Connector for Tomcat server.xml file
<Connector port="8090" protocol="HTTP/1.1"
connectionTimeout="20000"
maxThreads="400"
compression="on"
compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript"
redirectPort="8443"
server="whateverFakeName"
URIEncoding="UTF-8" />
@mortenbra
mortenbra / xe_post_install_optimize.sql
Last active August 29, 2015 14:22
Adjust session, process and memory parameters for Oracle XE after install
-- run as SYS
sqlplus /nolog
connect sys as sysdba
-- show current values
show parameters sessions;
show parameters processes;
show parameters memory;
-- adjust values
@mortenbra
mortenbra / java_env.sh
Created June 10, 2015 05:09
Add Java environment variables to bash profile in CentOS
# setup Java environment in bash profile to be able to access java from anywhere
# http://stackoverflow.com/questions/16823591/how-to-add-lines-to-end-of-file-linux
# http://www.davidghedini.com/pg/entry/install_tomcat_7_on_centos
echo "JAVA_HOME=/usr/java/latest" >> /root/.bash_profile
echo "export JAVA_HOME" >> /root/.bash_profile
echo "PATH=$JAVA_HOME/bin:$PATH" >> /root/.bash_profile
echo "export PATH" >> /root/.bash_profile