Tuesday, July 23, 2013

Installing Oracle Enterprise 11g R2

Tested with: Fedora 18 / 19


Based on:


http://www.oracle-base.com/articles/11g/oracle-db-11gr2-installation-on-fedora-17.php

http://www.habitualcoder.com/?p=248


A. Get the files:


http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

B. Install required packages:


#---
yum -y install \
ksh \
xterm \
unzip \
binutils \
compat-libstdc++-33 \
compat-libstdc++-33.i686 \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc.i686 \
glibc-common \
glibc-devel \
glibc-headers \
glibc-devel.i686 \
ksh \
libaio \
libaio.i686 \
libaio-devel \
libaio-devel.i686 \
libgcc \
libgcc.i686 \
libstdc++ \
libstdc++.i686 \
libstdc++-devel \
make \
numactl \
numactl-devel \
sysstat \
unixODBC \
unixODBC.i686 \
unixODBC-devel \
unixODBC-devel.i686 \
glibc-static.x86_64 \
glibc-static.i686
#---

C. Prepare environment:


1. Create user and groups:

#---
groupadd oinstall
groupadd dba
groupadd oper
groupadd asmadmin

useradd -g oinstall -G dba,oper,asmadmin oracle
#---

2. Create directories:

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

3. Mimic a Red Hat box:


#---
cp /etc/redhat-release /etc/redhat-release.orig.`date +"%Y-%m-%d"`
#---

#---
cat > /etc/redhat-release << __END__
redhat release 5
__END__
#---

4. Set up kernel parameters:


#---
cat >> /etc/sysctl.conf << __END__
########################################
# Oracle setup
########################################
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
########################################
__END__
#---

5. Add security resource limits for oracle user:


#---
cat >> /etc/security/limits.conf << __END__
########################################
# Oracle setup
########################################
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
########################################
__END__
#---

6. Add limits to PAM:


#---
cat >> /etc/pam.d/login << __END__
########################################
# Oracle setup
########################################
session required pam_limits.so
########################################
__END__
#---

7. Disable SELinux


Edit /etc/selinux/config and set it to (you need to reboot to take effect):

SELINUX=disabled

D. Preprare remote access to your X11 session:


http://gka-linux.blogspot.com.br/2013/07/enabling-remote-x11-access.html

E. Setup the oracle user:


1. Become oracle:

#---
su - oracle
#---

2. Setup the environment variables:

#---
cat >> ${HOME}/.bash_profile << __END__
########################################
# Oracle setup
########################################
export TMP=/tmp
export TMPDIR=/tmp

export ORACLE_HOSTNAME=localhost
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\${ORACLE_BASE}/product/11.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_TERM=xterm
export ORACLE_INSTANT_CLIENT=/usr/lib/oracle/11.2/client64
export PATH=\${ORACLE_HOME}/bin:\${PATH}:/usr/sbin:\${HOME}/.local/bin:\${HOME}/bin:\${ORACLE_INSTANT_CLIENT}/bin

export LD_LIBRARY_PATH=\${ORACLE_HOME}/lib:/lib:/usr/lib:\${LD_LIBRARY_PATH}:\${ORACLE_INSTANT_CLIENT}/lib
export CLASSPATH=\${ORACLE_HOME}/JRE:\${ORACLE_HOME}/jlib:\${ORACLE_HOME}/rdbms/jlib:\${ORACLE_INSTANT_CLIENT}/lib

if [ oracle = "oracle" ]; then
if [ /bin/bash = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
########################################
 
__END__
#---

2.1. For any developer user you might need to add the following to their environment:

#---
cat >> ${HOME}/.bash_profile << __END__
########################################
# Oracle setup
########################################
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\${ORACLE_BASE}/product/11.2.0/db_1
export ORACLE_SID=orcl
export ORACLE_INSTANT_CLIENT=/usr/lib/oracle/11.2/client64
export PATH=\${ORACLE_HOME}/bin:\${PATH}:/usr/sbin:\${HOME}/.local/bin:\${HOME}/bin:\${ORACLE_INSTANT_CLIENT}/bin

export LD_LIBRARY_PATH=\${ORACLE_HOME}/lib:/lib:/usr/lib:\${LD_LIBRARY_PATH}:\${ORACLE_INSTANT_CLIENT}/lib
export CLASSPATH=\${ORACLE_HOME}/JRE:\${ORACLE_HOME}/jlib:\${ORACLE_HOME}/rdbms/jlib:\${ORACLE_INSTANT_CLIENT}/lib
########################################
 
__END__
#---

3. Make profile effective:


#---
source $HOME/.bash_profile
#---

3.1. Check it, if not effective, logout and in again


#---
echo $ORACLE_SID
#---

Expected:
orcl

F. Install:


1. Unzip packages, which I assume are in the $HOME from oracle user:


#---
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
#---

2. Run install script:


2.1. Do NOT forget to allow the oracle host to connect remotely to your X11

xhost +<oracle host>

2.2. Do NOT forget to export the DISPLAY variable:

export DISPLAY=<Host running X11>:0.0

2.3. If it is the same host:

On your REGULAR account:
#---
xhost +localhost
#---

On the ORACLE user shell:
#---
export DISPLAY=localhost:0.0
#---

2.4. Install

#---
cd database
./runInstaller
#---

3. It will fail in 2 situations, follow instructions at:


http://www.habitualcoder.com/?p=248

G. Post install:


1. Restore /etc/redhat-release to the original value: 

#---
# It only works if you did C.3. on the same date as the restore
cp /etc/redhat-release.orig.`date +"%Y-%m-%d"` /etc/redhat-release
#---


2. Execute the post install scripts:

#---
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db_1/root.sh
#---


3. Edit /etc/oratab to the following:

orcl:/u01/app/oracle/product/11.2.0/db_1:Y

4. Start Oracle (as oracle):

Listeners:
#---
lsnrctl start
#---


Database:
#---
sqlplus / as sysdba << EOF
STARTUP;
EXIT;
EOF
#---





Enabling remote X11 access


Tested with: Fedora 18 and 19

A. Enable overall access (Fedora 19 only)

Edit file:




/lib/systemd/system/initial-setup-graphical.service

Remove or comment out the daemon blocking argument, it should look like:

ExecStart=/bin/xinit /bin/firstboot-windowmanager /bin/initial-setup -- /bin/Xorg :9 -ac #-nolisten tcp

B. Enable at the display manager, in my case LightDM:


/etc/lightdm/lightdm.conf

Must include the following parameters under the following sessions:

...
[SeatDefaults]
xserver-allow-tcp=true
...
[security]
DisallowTCP=false
...

C. Restart the DM:


#---
systemctl restart lightdm.service
#---

D. Verify if it is up:


#---
netstat -nl | grep :6000
#---

Expected:
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN
tcp6 0 0 :::6000 :::* LISTEN

E. Open up firewalld:


https://fedoraproject.org/wiki/FirewallD?rd=FirewallD/#Permanent_and_Temporary_Configuration

F. Add to connecting host:


#---
xhost +<remote host trying to use your X11>
#---


G. (On the remote host) Inform where the X11 is:


#---
export DISPLAY=<your running X11 hostname>:0.0
#---


H. (On the remote host) Test it:

#---
zenity --info --text="OK: `hostname`"
#---

Sunday, June 09, 2013

My Fedora 19 (Beta) road map

- If you have had problems with automatically mounting LUKS partition, see my post addressing the issue here

- Add repositories:
-- RPM Fusion (free)
#---
yum -y localinstall --nogpgcheck \
http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
#---


-- RPM Fusion (non-free)
#---
yum -y localinstall --nogpgcheck \
http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
#---


-- Adobe (Flash plugin, AdobeAIR and AcrobatReader) 32 bits:
#---
yum -y localinstall --nogpgcheck \
http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
#---


-- Adobe Flash for 64bits:
#---
yum -y localinstall --nogpgcheck \
http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm
#---


-- Chromium (for Fedora here):
#---
wget http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-chromium-stable.repo -O /etc/yum.repos.d/fedora-chromium.repo
#---


-- Setting up a not-so-restricting SELinux: here

-- MATE desktop (here):
#---
yum -y group install \
mate
#---


-- Remove things I do NOT like (do not remove xine if you prefer KDE):

--- Multimedia players that do not play divx/mp3 and stays as default for video and audio files:
#---
yum -y erase \
totem* \
brasero*
#---



-- Update your system:
#---
yum -y upgrade --nogpgcheck
#---


- Install additional software:
-- GTK IM modules (for c cedilla, for instance):
#---
yum -y install \
gtk3-immodules
#---


C Cedilla with Gnome

-- Chromium:
#---
yum -y install \
chromium
#---


-- PulseAudio volume control (must-have):
#---
yum -y install \
pavucontrol
#---


-- Multimedia:
#---
yum -y install \
mplayer \
mencoder \
live555 \
gecko-mediaplayer \
gnome-mplayer \
vlc \
grip \
flash-plugin \
k3b \
k3b-extras-freeworld
#---


Because Adobe Reader is usually very slow to download, I keep it separated and leave it to be last installed.
#---
yum -y install \
AdobeReader_enu
#---


-- Spell-checking
--- Additional languages: German (de), Spanish (es), French (fr), and Portuguese from Brazil (br)
#---
yum -y install \
hunspell-de \
hunspell-es \
hunspell-fr \
hunspell-br
#---


-- Menu editing tool:
#---
yum -y install \
alacarte
#---


-- Audacious (XMMS is not that great anymore):
#---
yum -y install \
audacious \
audacious-plugin-fc \
audacious-plugins-amidi \
audacious-plugins-exotic \
audacious-plugins-freeworld-aac \
audacious-plugins-freeworld-ffaudio \
audacious-plugins-freeworld-mms \
audacious-plugins-freeworld-mp3 \
audacious-plugins-freeworld \
audacious-plugins-jack \
audacious-plugins-sid \
audacious-plugins \
audacious-plugin-xmp
#---


-- Pidgin, a very good IM client
#---
yum -y install \
pidgin \
pidgin-guifications \
pidgin-libnotify \
pidgin-otr \
pidgin-musictracker \
purple-plugin_pack-pidgin \
purple-microblog \
pidgin-sipe \
purple-msn-pecan
#---


--- If you use LaTeX you may find this plugin appealing:
#---
yum -y install \
pidgin-latex
#---


-- For kernel modules:
#---
yum -y install \
dkms \
kernel-devel \
kernel-headers
#---


-- Disk utilities:
#---
yum -y install \
gparted \
gnome-disk-utility
#---



-- Misc

--- Backups with Back In Time:
#---
yum -y install \
backintime-common \
backintime-gnome
#---


--- Benchmarking:
#---
yum -y install \
bonnie++ \
phoronix-test-suite
#---


--- Diagrams and images, usually old stuff that I'm used to
#---
yum -y install \
ImageMagick \
graphviz \
dia \
gv \
xfig \
gnuplot \
inkscape
#---


--- Video editing
#---
yum -y install \
pitivi
#---


--- Screen capture
#---
yum -y install \
gnome-screenshot
#---


--- Editors and related
#---
yum -y install \
gvim \
ctags \
dictd \
diction
#---


--- My beloved spreadsheet program
#---
yum -y install \
gnumeric
#---


--- Compression related programs
#---
yum -y install \
sharutils \
unrar \
p7zip
#---


--- Administration related programs
#---
yum -y install \
telnet \
lsof \
nmap \
nc \
traceroute \
mc \
rdesktop
#---


--- Very nice "must-have" admin programs:
#---
yum -y install \
gnome-password-generator
#---


--- For WLAN Cracking
#---
yum -y install \
aircrack-ng \
airsnort
#---


-- Development

--- Debug related programs
#---
yum -y install \
gdb \
gcc \
strace \
ltrace
#---


--- For GIT support:
#---
yum -y install \
git-all
#---


--- For Java development:
#---
yum -y install \
maven
#---


-- Update your system:
#---
yum -y upgrade
#---


- Install and setup third-part programs
-- VirtualBox/VMware Player
-- Skype
-- Real Player (check for the RPM version)
-- Sun Java
-- Eclipse
-- NetBeans

- Setup printers

- Backup [/etc] and [/boot/grub]
#---
tar -czf bkp-system.`/bin/date +"%Y%m%d-%H%M"`.tgz /etc /boot/grub
#---


Related posts:
- Installing Skype in 64bits (external link)
- Mounting former LUKS partition
- SELinux
- Road map for Fedora 17
- Making USB to work with VirtualBox (external link)
- Adding security to SSH
- Backups with Back In Time
- C Cedilla with Gnome

Sunday, January 27, 2013

Cedilla on Fedora 18 and GTK 3.X


I couldn't find anywhere a recipe for putting cedilla as default on Fedora 18. None of them work properly for my environment, which is:
  • Desktop in a non-Portuguese language (in my case English)
  • Make the combination + produce a cedilla (รง)
The way I did it is:

1. Set Input Method to NONE:


Go to
-> System -> Preferences ->  Input Method Selector.


This should produce a window similar to that below. Select: No Input Method



2. Set, in your .bash_profile, to use ibus:

Edit your ${HOME}/.bash_profile file and add the following:

export GTK_IM_MODULE=ibus

Or:

#---
cat >> ${HOME}/.bash_profile << __END__
export GTK_IM_MODULE=ibus
__END__
#---


3. Setup GTK:


Add your language (in red) to the corresponding lines in:

/usr/lib/gtk-3.0/3.0.0/immodules.cache: 
"/usr/lib/gtk-3.0/3.0.0/immodules/im-cedilla.so"
"cedilla" "Cedilla" "gtk30" "/usr/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa:de:en"


/usr/lib64/gtk-3.0/3.0.0/immodules.cache:
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-cedilla.so"
"cedilla" "Cedilla" "gtk30" "/usr/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa:en:de"


/etc/gtk-2.0/x86_64-redhat-linux-gnu/gtk.immodules:
"/usr/lib64/gtk-2.0/2.10.0/immodules/im-cedilla.so"
"cedilla" "Cedilla" "gtk20" "/usr/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa:en:de"


Sources:

https://wiki.archlinux.org/index.php/IBus

Saturday, January 05, 2013

My Fedora 18 road map

- If you have had problems with automatically mounting LUKS partition, see my post addressing the issue here

- Add repositories:
-- RPM Fusion (free)
#---
yum -y localinstall --nogpgcheck \
http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
#---


-- RPM Fusion (non-free)
#---
yum -y localinstall --nogpgcheck \
http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
#---


-- Adobe (Flash plugin, AdobeAIR and AcrobatReader) 32 bits:
#---
yum -y localinstall --nogpgcheck \
http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
#---


-- Adobe Flash for 64bits:
#---
yum -y localinstall --nogpgcheck \
http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm
#---


-- Chromium (for Fedora here):
#---
wget http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-chromium-stable.repo -O /etc/yum.repos.d/fedora-chromium.repo
#---


-- Setting up a not-so-restricting SELinux: here

-- MATE desktop (here):
#---
yum -y group install \
mate
#---


-- Remove things I do NOT like (do not remove xine if you prefer KDE):

--- Multimedia players that do not play divx/mp3 and stays as default for video and audio files:
#---
yum -y erase \
totem* \
brasero*
#---



-- Update your system:
#---
yum -y upgrade --nogpgcheck
#---


- Install additional software:
-- GTK IM modules (for c cedilla, for instance):
#---
yum -y install \
gtk2-immodules
#---


--- If it doesn't install (file conflict):
#---
rpm -Uvhi --force \
/var/cache/yum/*/*/*/packages/gtk2-immodules*.rpm
#---


C Cedilla with Gnome

-- Chromium:
#---
yum -y install \
chromium
#---



-- PulseAudio volume control (must-have):
#---
yum -y install \
pavucontrol
#---


-- Multimedia:
#---
yum -y install \
mplayer \
mencoder \
live555 \
gecko-mediaplayer \
gnome-mplayer \
vlc \
grip \
flash-plugin \
k3b \
k3b-extras-freeworld
#---


Because Adobe Reader is usually very slow to download, I keep it separated and leave it to be last installed.
#---
yum -y install \
AdobeReader_enu
#---


-- Spell-checking
--- Additional languages: German (de), Spanish (es), and Portuguese from Brazil (br)
#---
yum -y install \
hunspell-de \
hunspell-es \
hunspell-br
#---


-- Menu editing tool:
#---
yum -y install \
alacarte
#---


-- Audacious (XMMS is not that great anymore):
#---
yum -y install \
audacious \
audacious-plugin-fc \
audacious-plugins-amidi \
audacious-plugins-exotic \
audacious-plugins-freeworld-aac \
audacious-plugins-freeworld-ffaudio \
audacious-plugins-freeworld-mms \
audacious-plugins-freeworld-mp3 \
audacious-plugins-freeworld \
audacious-plugins-jack \
audacious-plugins-sid \
audacious-plugins \
audacious-plugin-xmp
#---


-- Pidgin, a very good IM client
#---
yum -y install \
pidgin \
pidgin-guifications \
pidgin-libnotify \
pidgin-otr \
pidgin-gfire \
pidgin-musictracker \
purple-plugin_pack-pidgin \
purple-facebookchat \
purple-microblog \
pidgin-sipe \
purple-msn-pecan
#---


--- If you use LaTeX you may find this plugin appealing:
#---
yum -y install \
pidgin-latex
#---


-- For kernel modules:
#---
yum -y install \
dkms \
kernel-devel \
kernel-headers
#---


-- Misc

--- Backups with Back In Time:
#---
yum -y install \
backintime-common \
backintime-gnome
#---


--- Benchmarking:
#---
yum -y install \
bonnie++ \
phoronix-test-suite
#---


--- Diagrams and images, usually old stuff that I'm used to
#---
yum -y install \
ImageMagick \
graphviz \
dia \
gv \
xfig \
gnuplot \
inkscape
#---


--- Video editing
#---
yum -y install \
pitivi
#---


--- Screen capture
#---
yum -y install \
gnome-screenshot
#---


--- Editors and related
#---
yum -y install \
gvim \
ctags \
dictd \
diction
#---


--- My beloved spreadsheet program
#---
yum -y install \
gnumeric
#---


--- Compression related programs
#---
yum -y install \
unrar \
p7zip
#---


--- Administration related programs
#---
yum -y install \
telnet \
lsof \
nmap \
nc \
traceroute \
mc \
AcetoneISO2 \
rdesktop
#---


--- Very nice "must-have" admin programs:
#---
yum -y install \
gnome-password-generator
#---


--- For WLAN Cracking
#---
yum -y install \
aircrack-ng \
airsnort
#---


-- Development

--- Debug related programs
#---
yum -y install \
gdb \
gcc \
strace \
ltrace
#---


--- For GIT support:
#---
yum -y install \
git-all
#---


--- For Java development:
#---
yum -y install \
maven
#---


-- Update your system:
#---
yum -y upgrade
#---


- Install and setup third-part programs
-- VirtualBox/VMware Player
-- Skype
-- Real Player (check for the RPM version)
-- Sun Java
-- Eclipse
-- NetBeans

- Setup printers

- Backup [/etc] and [/boot/grub]
#---
tar -czf bkp-system.`/bin/date +"%Y%m%d-%H%M"`.tgz /etc /boot/grub
#---


- Some issues:
-- Skype may need some extra configuration (see link for 64bits) and some SELinux relaxation (see link for SELinux).

#---
yum -y install \
libXScrnSaver.i686 \
libX11.i686 \
libv4l.i686 \
libXv.i686 \
qt.i686 \
qt-x11.i686 \
qtwebkit.i686 \
alsa-lib.i686 \
alsa-plugins-pulseaudio.i686 \
--setopt=protected_multilib=false
#---


Related posts:
- Installing Skype in 64bits (external link)
- Mounting former LUKS partition
- SELinux
- Road map for Fedora 17
- Making USB to work with VirtualBox (external link)
- Adding security to SSH
- Backups with Back In Time
- C Cedilla with Gnome

Thursday, July 26, 2012

HP Virtual Room

Tested versions:

  • HP Virtual Room: 8.0 Update 77 Build 4300
  • Fedora: 17 x86_64

Procedure:

1. Get the software from

https://www.rooms.hp.com/resources/ 


Tested file: hpvirtualrooms-install64-F4-8.0.0.4300.tar.gz

2. Install necessary packages:

#---
yum -y install \
glibc.i686 \
libpng-compat.i686 \
libxml2.i686 \
libSM.i686 \
gtk2.i686 \
alsa-lib.i686 \
mesa-libGLU.i686
#---

 

3. Unzip the package and run the install script:

#---
tar -vxzf hpvirtualrooms-install64-<version>.tar.gz
#---

#---
cd hpvirtualrooms-install
./install-hpvirtualrooms
#---

Note: It will remove the [hpvirtualrooms-install] directory, so do expect it.

4. You should now have a new menu entry at [Internet] for the [HP Virutal Rooms]


Enjoy!

Sunday, June 17, 2012

Jenkins

Tested Versions:

Official documentation:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins

 

A. Install:

1. Add the Jenkins repository:

#---
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
#---

2. Install the packages:

#---
yum -y install \
jenkins \
xorg-x11-server-Xvfb
#---

3. Start and check the server:

#---
/etc/init.d/jenkins start
#---

Check at the url below:
http://localhost:8080/

B. Make it run permanently as a stand-alone daemon:

#---
chkconfig --level 345 jenkins on
#---

4. Network problems:

In case your network does not work properly try adding the following line to your Jenkins setup file [/etc/sysconfig/jenkins]:

JENKINS_JAVA_OPTIONS="${JENKINS_JAVA_OPTIONS} -D-Djava.net.preferIPv4Stack=true"

5. Important files:

Configuration:
/etc/sysconfig/jenkins
Logs:
/var/log/jenkins/jenkins.log

C. Running on an existing Tomcat instance:


1. Stop any running stand-alone Jenkins instance

#---
/etc/init.d/jenkins stop
#---


2. Do not let Jenkins start automatically as a daemon:

#---
chkconfig --level 345 jenkins off
#---


3. Deploy Jenkins application:

#---
cp /usr/lib/jenkins/jenkins.war /var/lib/tomcat/webapps/
#---


4. Restart and enable Tomcat as service:

#---
systemctl restart tomcat.service
#---

#---
systemctl enable tomcat.service
#---


5. Check if it is running:

http://localhost:8080/jenkins/


6. Log files:

/var/log/tomcat/catalina.out
/var/log/tomcat/*

7. Network problems:

In case your network does not work properly try adding the following line to your TomCat setup file [/etc/tomcat/tomcat.conf]:

JAVA_OPTS="-Djava.net.preferIPv4Stack=true"

Saturday, June 16, 2012

Agilo

Tested versions:


  • Fedora: 17 x86_64
  • PostgreSQL: 9.1.4 x86_64
  • Trac: 0.12.3 noarch
  • Agilo: 0.9.7 noarch

Trac installation here

Official documentation:
http://www.agilofortrac.com/en/documentation/installation-guide/

1. Install package:

#---
yum -y install trac-agilo-plugin.noarch
#---

2. Setup your Trac project:


Add the following lines to your trac.ini file:
[components]
agilo.* = enabled


Assuming that you left from the Trac installation:
/var/local/trac/projects/tst/conf/trac.ini

3. Update your project setup:

Assuming that you left from the Trac installation:
#---
trac-admin /var/local/trac/projects/agilo upgrade
trac-admin /var/local/trac/projects/agilo wiki upgrade
#---

4. Check if it is working acessing the project URL


Assuming that you left from the Trac installation:
http://localhost/trac/tst

Related posts:


Trac

Installing Trac:


Tested versions:

  • Fedora: 17 x86_64
  • PostgreSQL: 9.1.4 x86_64
  • Trac: 0.12.3 noarch
PostgreSQL install procedure: here

Official documentation:
http://trac.edgewall.org/wiki/TracInstall

A. Install Trac and PostgreSQL support


1. Minimal installation:

#---
yum -y install \
trac \
python-storm-postgresql
#---

2. Some interresting plugins:

#---
yum -y install \
trac-git-plugin \
trac-iniadmin-plugin \
trac-customfieldadmin-plugin \
trac-accountmanager-plugin \
trac-sumfields-plugin \
trac-ticketdelete-plugin \
trac-tocmacro-plugin
#---

B. Create PostgreSQL database:


Offical documentation:
http://trac.edgewall.org/wiki/DatabaseBackend#Postgresql

1. Create user [trac], pass [pass], and database [trac_db]

#---
createuser -U postgres -W -D -R -S trac
psql -U postgres -W -c "ALTER USER trac WITH PASSWORD 'pass';"
createdb -U postgres -W trac_db
psql -U postgres -W -c "GRANT ALL ON DATABASE trac_db TO trac;"
#---

2. Check connectivity:

#---
psql -U trac -d trac_db -h localhost -p 5432 -W -c "SELECT 1;"
#---

3. In case you need to remove the database:

#---
dropdb -U postgres -W trac_db
#---

4. In case you need to remove the user:

#---
dropuser -U postgres -W trac
#---

C. Standalone version:


1. Create directory:

#---
mkdir /var/local/trac
#---

2. Add user:

#---
useradd -m -d /var/local/trac -s /bin/bash -c "Trac stand-alone daemon user" trac
#---

3. Reset home dir owner:

#---
chown trac:trac /var/local/trac
#---

4. Check trac setup:


#---
su - trac
#---

#---
pwd
#---

Expected:
/var/local/trac

5. Create project dirs

#---
mkdir -p /var/local/trac/projects/tst
#---

6. Initialize Trac project environment:

#---
trac-admin /var/local/trac/projects/tst initenv
#---

When asked about the connection string give the following:
postgres://trac:pass@localhost:5432/trac_db

7. In case you fail, remove all and start it over:


#---
rm -rf /var/local/trac/projects/*
#---

Just in case: recreate the database (dropdb followed by createdb)

8. Check if it is ok:

#---
tracd --port 8000 /var/local/trac/projects/tst
#---

Open your browser and point it to:
http://localhost:8000/tst

D. Apache version:


Official documentation:
http://trac.edgewall.org/wiki/TracModWSGI

1. Install packagers:

#---
yum -y install \
httpd \
mod_wsgi
#---

2. Deploy http content (with CGIs):

#---
trac-admin /var/local/trac/projects/tst deploy /var/local/trac/projects/tst
#---

3. Set permissions:

#---
usermod -a -G apache trac
chown -R apache:apache /var/local/trac
chmod -R g+rw /var/local/trac
#---

4. Set SElinux context:

#---
chcon -R -v --type=httpd_sys_rw_content_t /var/local/
semanage fcontext -a -t httpd_sys_rw_content_t "/var/local/(/.*)?"
#---

5. Check permissions:

#---
ls -lZ /var/local/
#---

Expected:
drwxrwxrwx. apache apache system_u:object_r:httpd_sys_content_t:s0 trac

6. Allow apache to connect to database (SElinux):

#---
setsebool -P httpd_can_network_connect_db 1
#---

7. Create apache conf file:

#---
cat > /etc/httpd/conf.d/trac-tst.conf << __END__
WSGIScriptAlias /trac/tst /var/local/trac/projects/tst/cgi-bin/trac.wsgi


    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all

__END__
#---

8. Put apache to run:

#---
systemctl enable httpd.service
systemctl start httpd.service
#---

9. Check if it is running:

http://localhost/trac/tst

E. Important logs:

/var/log/httpd/error_log
/var/log/messages


F. If you need to create several projects here are some scripts that automate the process:


createprj.sh:
https://dl.dropbox.com/u/9583089/createprj.sh
createdb.sh:
https://dl.dropbox.com/u/9583089/createdb.sh
trac-tpl.conf:
https://dl.dropbox.com/u/9583089/trac-tpl.conf

Put these files into [/var/local/trac/] and execute (as root):

Usage:
./createprj.sh <project> <db username> <db pass> [<project name>]

E.g.:

#---
./createprj.sh test_prj trac pass "My automatically created Test Project"
#---


G. Authentication

This is left out-of-the scope and can be easily implemented following the instructions on the official documentation:
http://trac.edgewall.org/wiki/TracModWSGI#ConfiguringAuthentication
http://trac.edgewall.org/wiki/TracPermissions

To the automated process on section F, just edit the [trac-tpl.conf] file to include the setup for your preferred authentication method.

Related posts:

PostgreSQL

Installation and basic usage of PostgreSQL 9.X


Tested versions:


A. Install packages:


#---
yum -y install \
postgresql \
postgresql-server
#---


B. Initialize environment:

#---
su - postgres
#---

#---
pwd
#----

Expected:

/var/lib/pgsql

#---
/usr/bin/initdb /var/lib/pgsql
logout
#---


C. Put PostgreSQL service to run


1. Check if PostgreSQL is running:

#---
systemctl status postgresql.service
#---

1.1. If not, just enable it and start it:

#---
systemctl enable postgresql.service
systemctl start postgresql.service
#---


1.2. Check if it has listeners running:

#---
netstat -nl --inet --inet6 | grep 5432
#---

Expected:
tcp        0      0 127.0.0.1:5432              0.0.0.0:*                   LISTEN     
tcp        0      0 ::1:5432                    :::*                        LISTEN  

D. Check accessibility

#---
psql -U postgres -c "SELECT 1;"
#---

Expected:
 ?column?
----------
        1
(1 row)

E. Set postgres user password

#---
psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'postgres';"
#---

F. Close 'trust' access

#---
su - postgres
#---

1. Edit [/var/lib/pgsql/data/pg_hba.conf]

Change all 'trust' entries by 'password'

Example:
local   all   postgres   trust

Should become:
local   all   postgres   password

2. Restart PostgreSQL

#---
systemctl restart postgresql.service
#---

3. Check access:


#---
psql -U postgres -c "SELECT 1;"
#---

Expected:
Password for user postgres:
 ?column?
----------
        1
(1 row)


G. Database and users 101:


1. Create user:


#---
createuser -U postgres -W -D -R -S test_user
psql -U postgres -W -c "ALTER USER test_user WITH PASSWORD 'test_pass';"
#---

2. Create database:

#---
createdb -U postgres -W -E UTF8 -O test_user test_db
psql -U postgres -W -c "GRANT ALL ON DATABASE test_db TO test_user;"
#---

3. Check access:

#---
psql -U test_user -d test_db -W -c "SELECT 1;"
#---

4. Remove database:

#---
dropdb -U test_user -W test_db
#---

5. Remove user:

#---
dropuser -U postgres -W test_user
#---

6. Check user removal:

#---
psql -U test_user -d test_db -W -c "SELECT 1;"
#---

Expected:
Password for user test_user:
psql: FATAL:  password authentication failed for user "test_user"

H. Important logs:


/var/lib/pgsql/data/pg_log/*
/var/log/messages