CAT | linux
8
CentOS NFS How-to Guide: Exporting and Mounting a NFS Drive
0 Comments | Posted by Qug in Networking, linux
This guide shows you how to start an NFS service on one (host) machine, export the NFS drive, and then connect to that NFS drive from a client machine.
## On the NFS host machine:
#Start Portmap service if needed.
#NFS uses portmap and a bunch of ports (that you can set in /etc/sysconfig/nfs) if you want.
See this link for more details on NFS ports.
#Start portmap service
service portmap status
service portmap start (if needed)
#Start NFS
service nfs start
#Edit /etc/exports
#Reference: https://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/ref-guide/s1-nfs-server-export.html
Format is (select the options you want):
[Directory to export] [Hosts to allow](options)
/home/just_testing 192.168.0.0/24(rw,async,wdelay,root_squash)
#Run exportfs to refresh NFS exports
exportfs -av
Be sure the proper ports are open on iptables
Reference: http://pario.no/2008/01/15/allow-nfs-through-iptables-on-a-redhat-system/
## Now on your NFS client machine:
Start portmap
service portmap start
Create a mount point and mount the NFS drive. Remember to use your own server’s IP address:
mkdir /mnt/nfs-usbdisk
mount 192.168.0.2:/home/just_testing /mnt/nfs-usbdisk
Voila ! Tail your logs if you have any problems !
6
How to mount an Amazon S3 bucket as virtual drive on CentOS 5.2
4 Comments | Posted by Qug in Amazon Web Services, linux
#Note: If you are using CentOS 4, it’s the same general process. You might have more difficulty finding the packages to install fuse and dependencies.
This is a simple guide on how to mount your S3 bucket as a “virtual drive”. This is great for backing up your data to S3, or downloading a bunch of files from S3.
#First, make sure you have the fuse package installed.
#On CentOS, fuse is available from RPMforge
#http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
#Now install fuse
yum install fuse
modprobe fuse
#Download s3fs and make
cd /usr/local/src
wget http://s3fs.googlecode.com/files/s3fs-r191-source.tar.gz
cd s3fs
make
#Copy the binary to /usr/local/bin (or wherever you prefer)
cp s3fs /usr/local/bin
#Make a mount point
mkdir /mnt/s3drive
#Mount your bucket like this:
s3fs bucketname -o accessKeyId=XXXXXXXXXXXXXXXXXXXX -o secretAccessKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX /mnt/s3drive
That’s it ! You can change directory to your virtual drive or start copying files !
Go ahead and use a visual client such as CyberDuck or S3Hub to verify with your own eyes that this actually worked. ![]()
Good luck!
17
OpenOffice Headless Mode Installation Word doc to pdf conversion
2 Comments | Posted by Qug in linux
How to set up OpenOffice to run in headless mode on Fedora 9
What we wanted was a system set up to convert any OpenOffice document to PDF. Most importantly, we needed to convert Word .doc files to .pdf, but in fact, any OpenOffice file types (.xls, .odt, .txt, .rtf, etc) will work, as long as you install the proper packages / dependencies!
Also important:
We will be starting OpenOffice in headless mode, which means no GUI. This should be started on boot up, and should just run in the background.
Install:
You don’t need to install all the OpenOffice packages if you don’t need them. We are mainly concerned with Word docs, so OoWriter is a must. We are running in headless mode, which means we don’t have a GUI to openoffice. So we can leave out a bunch of unnecessary packages.
- Here’s what we have installed:
openoffice.org-core.x86_64 1:2.4.2-18.3.fc9 installed
openoffice.org-headless.x86_64 1:2.4.2-18.3.fc9 installed
openoffice.org-pyuno.x86_64 1:2.4.2-18.3.fc9 installed
openoffice.org-sdk.x86_64 1:2.4.2-18.3.fc9 installed
openoffice.org-writer.x86_64 1:2.4.2-18.3.fc9 installed
openoffice.org-writer2latex.x86_64 0.5-2.fc9 installed
If you need to convert Excel spreadsheets, ppt Powerpoint presentations to pdf, you will need to install the corresponding package (ie. openoffice.org-calc, openoffice.org-draw, etc.)
After you have these packages installed, be sure you have the soffice command. By default it is here:
/usr/lib64/openoffice.org/program/soffice.bin
Next, try to start up the service with this command:
$ /usr/lib64/openoffice.org/program/soffice.bin -headless accept="socket,host=localhost,port=8100;urp;" -nofirststartwizard &
#Note: the ampersand (&) allows the command to run in background so you get your shell back.
You can specify whichever port you would like. The -nofirststartwizard flag does exactly that.
Next step is to find a script (client) that can interact with this OpenOffice service.
A few options are:
1. dag’s unoconv (Available from yum)
http://dag.wieers.com/home-made/unoconv/
2. PyODConverter – a cool Python script to do conversions
http://www.artofsolving.com/opensource/pyodconverter
3. Write your own!
We chose to use PyODConverter. It’s simple to use:
$ PyODConverter.py example.doc example.pdf
Lastly, I mentioned that we want this soffice to start up everytime we reboot.
Simply add the line to your /etc/rc.d/rc.local
# Start up openoffice for fax conversion
$ /usr/lib64/openoffice.org/program/soffice.bin -headless accept="socket,host=localhost,port=8100;urp;" -nofirststartwizard
And there you have it. Hope that helps somebody. Happy Conversions!
Hint: If you are getting strange unintelligible errors about “URL seems to be an unsupported one”, it may be that you have not installed a necessary openoffice package. That’s how I discovered I needed OoWriter …

