Sunday, March 10, 2013

Automatic removal of packages with dependencies

Good stuff for automation, if you want to remove packages on remote system with all it's dependencies, without interaction.

On RHEL:

yum remove --disablerepo=* -y 

for eg: yum remove firefox --disablerepo=* -y

On Solaris:

yes | pkgrm

for eg: yes | pkgrm SUNWjunk

On AIX:


installp -u -g

for eg: installp -u -g gskta





Labels: , , ,

Monday, November 15, 2010

/bin/sh is not /bin/bash on Solaris

I was trying to execute a script, which was generally meant to run on a Linux box. On executing the script I got the following error


bash-3.00# /test.sh
+ [ -e /etc/inittab ]
/test.sh: test: argument expected


The contents of test.sh is


bash-3.00# cat /test.sh
#!/bin/sh
set -x on
if [ -e /etc/inittab ]; then
echo true
fi

when I change the line #!/bin/sh to #!/bin/bash, the script execution works. Turns out that /bin/sh and /bin/bash aren't the same on Solaris and you need to ensure this change.

Labels: , ,

Wednesday, October 27, 2010

pkg-get utility in Solaris

Usually when you have to install any package in Solaris machine, using the traditional method of pkgadd you need to download the software and its dependencies, then sequentially attempt to install the dependencies + software. pkg-get is a great utility in Solaris, where you can install software from no.of different repositories without having to worry about the dependencies. Simply put its the apt-get of debian or yum of fedora system. Here's how you install pkg-get and use it.

- Download pkg-get: On the Solaris system you need to ensure that you have wget. In my system it was installed in /usr/sfw/bin/wget. However, /usr/sfw/bin was not in the PATH, hence I modified the PATH env variable like this `PATH=$PATH:/usr/sfw/bin`
Now download the pkg-get package like this `wget http://www.opencsw.org/pkg-get `
- Install pkg-get: `pkgadd -d pkg-get` . This will ask a few questions, answer them as usual and ensure CSWpkgget package is installed successfully.
- Initial configuration: The configuration file for pkg-get gets stored in /opt/csw/etc and the binary pkg-get in /opt/csw/bin. Add the bin path to global PATH. `PATH=$PATH:/opt/csw/bin`. Review the contents of pkg-get.conf file.
- Using pkg-get: To install a software say, MySQL Database, all you need to do it `pkg-get install mysql5`

Labels: , ,