Archive for the ‘Linux’ Category

Install BackupPC on CentOS 6.3

October 18, 2012 26 comments

Last week, my boss asked me to install BackupPC on CentOS 6.3. Why CentOS? I actually have the same question–sorry, am used to Debian; regardless, my quest begun but I have to confess, it was not as easy as it seemed since there were fewer How To’s, Tips, and references for CentOS, especially 6 or 6.3 for that matter. This is reason enough for me to blog the steps I undertook to successfully install BackupPC on CentOS 6.3 and make it work after a week of “trial and error”–I may be a Debian user but am not a Linux geek. I am instead part of this group . Without further ado, let’s get it on!

  1. You need to have a running CentOS 6.3. I installed it with minimal components on a VM via Hyper-V 2; “lean but mean” so to say.

  2. Using Putty, connect to your CentOS box and install these useful tools:
    • wget – an easy-to-use CLI download tool.
    • nano – a file editor for humans.
    • screen – I like this tool because it allows you to have different screens for every task you to do; very useful, it enhances your Putty experience
    • man – your dependable CLI technical support.

    Use this command yum -y install man nano screen wget

  3. You need to add two special repositories, EPEL and REMI. A number of the packages we need for this endeavor is not part of the Red Hat / CentOS package manifest.
    wget -c
    wget -c
    rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

  4. Enable the REMI repository.
    nano /etc/yum.repos.d/remi.repo

    Edit and save the above file to reflect this:

    name=Les RPM de remi pour Enterprise Linux $releasever – $basearch

  5. Install the BackupPC pre-requisites.
    yum -y install perl-Compress-Zlib perl-Archive-Zip perl-File-RsyncP perl-suidperl openssh-clients expect

  6. Do an update, then upgrade, to make sure everything is up-to-date.
    yum -y update
    yum -y upgrade

  7. We need to create the user account that BackupPC will use and assign a password for it.
    adduser backuppc
    passwd backuppc

    You will be prompted to key-in your desired password. Remember this password ’cause you will need it later.

  8. And now folks, the moment you’ve all been waiting for, the BackupPC installation!
    yum -y install BackupPC

    I wish the command was longer or better yet, extremely complex but that’s just it…

  9. After the package installation, two biggies are now in place, Apache and BackupPC. Verify that these services are listed in the startup script.
    chkconfig –list backuppc
    chkconfig –list httpd

    Notice that both are turned off.

  10. We need to make these two services start at startup. Do this:
    chkconfig backuppc on
    chkconfig httpd on

  11. You’re probably guessing what’s Apache got to do with BackupPC; well, it runs the web interface but we need to do some tasks before we can use it. We first need to create the access file.
    htpasswd -c /etc/BackupPC/apache.users backuppc

    You will be prompted for a password; just key-in the password you assigned the backuppc user awhile back.

  12. Edit and save the BackupPC configuration file for Apache.
    nano /etc/httpd/conf.d/BackupPC.conf

    Your changes should reflect something like this:
    order deny,allow
    deny from all
    #allow from
    #allow from ::1
    allow from all
    AuthType Basic
    AuthUserFile /etc/BackupPC/apache.users
    AuthName “backuppc”

  13. As a safety precaution, make a duplicate of the BackupPC main configuration file.
    cp /etc/BackupPC/ /etc/BackupPC/

  14. We’ll use screen to help us accomplish this next task.
    nano /etc/BackupPC/

    In nano, press CTRL + W; this will invoke the search facility. Search for this parameter $Conf\{ServerMesgSecret\}.

    Now, press CTRL + A + C; this will open another screen. Run this command:
    mkpasswd -l 32 -d 16

    Highlight the output then press CTRL + A + P; this will bring you back to the previous screen. Right-click your mouse to paste the output between the single quotes of the aforementioned configuration parameter. You should have something like this:
    $Conf{ServerMesgSecret} = ‘7687nR848l39etpm7812w1f-pj3iEpb7’;

    Next, search for this parameter $Conf{CgiAdminUsers} and add backuppc. You should have something like this:
    $Conf{CgiAdminUsers} = ‘backuppc’;

  15. This time, edit the Apache configuration file.
    nano /etc/httpd/conf/httpd.conf

    Changes should reflect these changes:
    User backuppc
    Group apache
    ServerName actual_server_hostname_or_IP_Address:80
    (e.g. ServerName

  16. Now, the secret that made the BackupPC web interface work:
    iptables -I INPUT -p tcp –dport 80 -j ACCEPT
    /sbin/service iptables save

    Just to make sure the firewall entry was saved, we verify.
    cat /etc/sysconfig/iptables. Result below:

    # Generated by iptables-save v1.4.7 on Mon Oct 15 15:57:49 2012
    :INPUT ACCEPT [0:0]
    :OUTPUT ACCEPT [4:464]
    -A INPUT -p tcp -m tcp –dport 80 -j ACCEPT
    -A INPUT -p icmp -j ACCEPT
    -A INPUT -i lo -j ACCEPT
    -A INPUT -p tcp -m state –state NEW -m tcp –dport 22 -j ACCEPT
    -A INPUT -j REJECT –reject-with icmp-host-prohibited
    -A FORWARD -j REJECT –reject-with icmp-host-prohibited
    # Completed on Mon Oct 17 15:57:49 2012

  17. We now are nearing completion, let’s start the services.
    service httpd start
    service backuppc start

  18. The finale, access the BackupPC web interface.

Whew, I sure am glad we’re done.

Now give yourself a pat on back for a job well done…

Hope this helps

Setup LAMP using Debian 6.0 (Squeeze)

April 10, 2011 2 comments

A colleague asked me if it was possible to setup a LAMP platform where he can evaluate a couple of CMSes (MOODLE, Drupal, Joomla and WordPress). Well, the answer is YES!

I have to admit that I am a Linux dork so please bear with me. For this tutorial, I will be using Oracle VirtualBox 4.0.4 r70112 on top of Windows 7 Ultimate. So here we go…


  1. Download at least the Debian net-install ISO and make sure you have Internet connection via your LAN or Windows Internet Connection Sharing (ICS).

  2. Download and Install Oracle VirtualBox (OVB).

  3. Launch OVB.

  4. Click New then Next when the wizard appears.

  5. In the Name field, type Debian-Squeeze.
    Notice that the Operating System and version parameters are automatically pre-selected.
  6. Click Next.

  7. In the Base Memory Size field, replace 384 to just 256. Actually, using 128 would be fine but just in case you decide to install and configure the X Window System, you’d be glad to have keyed-in 256.

  8. Click Next.

  9. Options are pre-selected in this stage, so just click Next.

  10. Click Next, when the Create New Virtual Disk wizard appears.

  11. Dynamically expanding storage is pre-selected, click Next.

  12. In the Size field, key-in 10 GB instead and click Next then click Finish and another Finish.


Notice that after creating the VM, it is now highlighted and a summary of the hardware is displayed. We need to do a little hardware tweaking before we dive into the installation proper.

  1. Click Settings. It looks like this VBox icon Settings.
    The Setting window will pop-up. You will see the major components on the left pane and details for a particular component on the right pane.

  2. Click Network on the left pane then select Bridged Adapter under Enable Network Adapter on the right pane.
    I prefer bridged so the VM gets its own IP configuration as opposed to NAT where IP configuration is shared with the host machine.

  3. Click Audio then uncheck Enable Audio.
    You won’t need audio on your Linux server.

  4. Click Storage then click Empty under IDE Controller.
  5. Click the CD/DVD icon CD/DVD icon then click Choose a virtual CD/DVD disk file from the context menu.

  6. Locate the Debian net-installer ISO file you downloaded and double-click it.

  7. Click OK to close the Settings window.

  8. Click Start to fireup the VM.
    A message box will appear. Make a mental note on the hotkey. The hotkey releases host input devices auto-captured by the VM. With this particular virtualization hypervisor, it’s the right Ctrl key.

  9. Click OK to close the message box.
    The VM should continue and displays the install option menu.

  10. Install is pre-selected, hit the Enter key.
    Pop-up message boxes could appear. Just click OK on those.

  11. English is pre-selected in the Select a language screen; hit Enter.
    If you opted to use a different language, use the arrow keys to select the appropriate language then hit Enter when you’re done.

  12. In the Country territory area, select appropriate country. In my case, it’s Philippines. Hit Enter when done.
    If for some reason your country or territory is not listed, select Other and hit Enter.
    You will have more selection; just hit Enter when you’re done.

  13. In the Keyboard layout page, just choose the appropriate keymap (American English, in my case); hit Enter.
  14. In the Hostname field, debian has been pre-entered. This is okay in the meantime so just hit Enter.
  15. If you’re using Windows ICS like me, you should have in the Domain name field. In any case, just hit Enter.
  16. In the Root password field, key-in a complex password like c0mpl3x_p@55w0rd just for fun and hit Enter.
  17. Re-type the same complex password and hit Enter.

  18. Key-in your full name in the Full name field then hit Enter.

  19. The setup wizard usually takes your first as username, if it’s okay with you, just hit Enter. Otherwise, hit the Backspace key and enter your desired user name and hit Enter.

  20. In the Password field for the new user, just key-in the same complex password and hit Enter.

  21. Repeat step 20.

  22. In the Partition Disks page, Guided – use entire disk is pre-selected hit Enter.

  23. Under Select disk to partition, the virtual hard disk is pre-selected, hit Enter.

  24. Under Partitioning scheme, All files in one partition is pre-selected, hit Enter.

  25. Finish partitioning and write changes to disk is pre-selected, hit Enter.

  26. Select Yes and hit Enter when prompted to write the changes to disk.

  27. Select the nearest mirror to your location and hit Enter.
    Choosing US-based mirrors aren’t always the best option when running a net install; other mirrors are faster.

  28. If you’re not using a proxy server, just hit Enter. Otherwise, key-in your proxy address and port instead.

  29. You don’t need the survey, hit Enter.

  30. Hit the space bar to deselect Desktop; you won’t need the GUI to run a Linux server. Hit Enter.

  31. Like Windows, Linux needs a bootloader. Since Yes is pre-selected, hit Enter.

  32. Finally, Setup tells you that the installation is done. But before hitting Enter, click the Devices menu then hover your mouse cursor to CD/DVD devices and uncheck the Debian install ISO to release it from the VM. Hit Enter when you’re done.
    The VM will reboot and would later present you with the login screen.

  33. Go ahead and login as root and key-in the password you assigned awhile back.

  34. If you instead installed the OS in a physical machine, you need to install four additional applications to your server. They are:

    • htop – tool you can use to monitor system resources in realtime. It’s like the System Monitor in Windows.
    • dselect – a menu driven tool to add/remove programs. At times, I use this to check which app version is installed.
    • openssh-server – a daemon allowing you to remotely manage your server from virtually anywhere in the world. Think of this as the Command-Line-Interface (CLI) version of Terminal Server (but closer to Telnet which happen to be removed now) in Windows.
    • screen – tool that allow you to create multiple workspaces while remotely managing your server. If you happen to use SysInternals’ Desktop, this is something like it except of course it’s CLI-based.

    To install these applications, you issue the following command
    apt-get install htop dselect openssh-server screen

  35. When the installation is complete, type ifconfig to determine the IP address of your server.

  36. One last thing, download putty from here. If you’re wondering what putty is, it’s a tool you use to remotely manage your server from Windows. More like Remote Desktop for the CLI.

  37. When the download is complete, simply double-click the application.

  38. In the Host Name (or IP Address) field, key-in the IP address of your server then click OK.
    You should shortly be prompted for your login name and password. Login as root and start your Linux remote administration.

Congratulations! You have just successfully installed Debian 6.0 (Squeeze). Up next, setting up your CMS platform.


Don’t worry, this procedure would be quick you won’t even know what hit you…

Install the Web Server

  1. Issue this command apt-get install apache2.

  2. Hit Enter to continue.
    By the way, the capitalized letter inside the bracket will be the default option when you hit Enter. In this case, it’s Y.

When you see the # prompt again, that means the installation is done.

Install the Database

There are a couple of databases available to Linux that you can use for the CMSes you want to install but majority of these usually has one particular database commonly used, MySQL.

  1. Issue the command apt-get install mysql-server.

  2. Hit Enter to continue.

  3. You will be prompted to key-in the MySQL root password. For your own sanity’s sake, don’t leave this empty, key-in your complex password
    Note: Keep the password in mind or securely store it where you can readily retrieve it; I use KisKis for this and for all the other passwords I use, personal and work-related. KisKis is acronym for Keep It Secret Keep It Safe. Try it, you’ll love it besides being FREE.

Install PHP 5 with CMS requisites

To install PHP 5 and other CMS requisites, issue this command
apt-get install php5 php5-mysql php5-gd php5-curl php-xml-rpc php5-imap libapache2-mod-auth-mysql

Oh, by the way, doing this tutorial in Ubuntu is almost identical. The only difference is that you use sudo to do root-related tasks. Unless you have explicitly enabled the root user account.

That’s it. You now have a working LAMP server based on Debian 6.0 (Squeeze)

Categories: Linux, VirtualBox, Windows 7 Tags:

Install DSpace in Debian 6.0 (Squeeze)

April 7, 2011 18 comments

I was tasked by our IT director (who, by the way, is a hardcore Debian fan) to install DSpace for the library for them to try and eventually use it as their archive repository. I searched the web for an idiot’s guide (because am a Windows guy) to install Dspace on Debian but didn’t find a suitable one, unfortunately. Here, am sharing what I did to successfully install and run Dspace after all the trial and error. By the way, I used SSH via Putty doing the procedures below; it made the task even lighter. Hope this helps…

Host PC:
Lenovo 3000
CPU Intel Centrino 1.66GHz
RAM 2.99GB usable
OS Windows 7 32bit Ultimate

Virtual Machine:
Hypervisor Oracle VirtualBox 4.0.4r70112
Audio Disabled
Network Bridged
OS Debian 6.0 (Squeeze)
Hostname dspace
Network DHCP reservation


1. Start the VM and login as root then install the pre-requisite applications (Java, Tomcat, Maven, Ant, PostgreSQL)
apt-get install sun-java6-jdk
During the Java package installation, just answer Y (Y is the default action when you hit Enter as with other application installation except if the application cannot be authenticated where N is the default action), OK (press the Tab key) and Yes (left arrow key) when prompted.
apt-get install tomcat6
apt-get install maven2 (Ant is bundled with this package. No need to install separately)
apt-get install postgresql

or if you have a very fast connection, you can do a single liner
apt-get install sun-java6-jdk tomcat6 maven2 postgresql

2. Just to make sure you won’t get a Java runtime misconfiguration, you do this
update-alternatives –config java

Select the selection number that says:
/usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode (in my case, I selected option 2 see screenshot)

3. Download the latest Dspace package. For some unknown reason, I am not able to access so I downloaded the package here.
Before downloading, change directory to /usr/src
cd /usr/src/
Then download the package
wget -c

4. Unpack the package.
ls dspace-1.7.0-release.tar.gz (just to verify the package is in the directory)
tar zxvf dspace-1.7.0-release.tar.gz

5. Create Linux user account for Dspace
useradd -m dspace (-m option creates user home directory)

6. Change ownership of newly unpacked directory
chown -R dspace:adm dspace-1.7.0-release

7. The next step involves Postgresql. It requires you to change the file system permission setting to trust localhost connections you do this by editing the pg_hba.conf file.
nano /etc/postgresql/8.4/main/pg_hba.conf

When you open the file, scroll down to the last portion where you will see the following entries

# Database administrative login by UNIX sockets
#local all postgres ident <<< comment this line and add line below
local all postgres trust

# “local” is for Unix domain socket connections only
#local all all ident <<< comment this line and add line below
local all all trust

8. Restart Postgresql to use the modified configuration
/etc/init.d/postgresql restart

9. Create Postgresql user account for DSpace
To verify Postgresql is running, type psql -U postgres
You should be able to login to Postgresql. Type \q to quit
Proceed by typing this command
createuser -U postgres -d -A -P dspace ; createdb -U dspace -E UNICODE dspace

key-in dspace when prompted for password and when asked to confirm password
key-in y when prompted to take action on role

10. Change directory to the initial configuration files repository
cd dspace-1.7.0-release/dspace/config/

10.1 Edit dspace.cfg particularly the following parameters:

# DSpace host name
dspace.hostname =

# DSpace base host URL
dspace.baseUrl = or http://ip_address:8080

– It is extremely important that you enter the correct information otherwise Dspace will not work
– If hostname is used, then an entry on your DNS server is a must. In BIND for example IN A x.x.x.x
or in the Windows host, add an entry in the Windows\System32\Drivers\etc\hosts file the should point to the DSpace VM.

# Name of the site — Dspace for AIIAS Hardinge Library

# Database name (“oracle”, or “postgres”) = ${} <<< comment this entry = postgres <<< uncomment this = oracle

# URL for connecting to database
#db.url = ${default.db.url} <<< comment this
db.url = jdbc:postgresql://localhost:5432/dspace <<< uncomment this

# JDBC Driver
#db.driver = ${default.db.driver} <<< comment this
db.driver = org.postgresql.Driver <<< uncomment this

# Database username and password
#db.username = ${default.db.username} \__ comment these
#db.password = ${default.db.password} /
db.username = dspace \__ uncomment these
db.password = dspace /

# SMTP mail server
mail.server =

# From address for mail
mail.from.address =

# Currently limited to one recipient!
feedback.recipient =

# General site administration (Webmaster) e-mail
mail.admin =

11. Change directory to /var then create dspace directory and chown directory ownership
cd /var
mkdir dspace
chown dspace dspace

12. Build the Maven package
cd /usr/src/dspace-1.7.0-release/dspace
mvn package

it will start downloading a lot of jar and pom files… until you see something like this:

[INFO] Copying 1386 files to /usr/src/dspace-1.7.0-release/dspace/target/dspace-1.7.0-build.dir
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] DSpace Addon Modules .................................. SUCCESS [8:46.193s]
[INFO] DSpace XML-UI (Manakin) :: Web Application ............ SUCCESS [1:02:46.078s]
[INFO] DSpace LNI :: Web Application ......................... SUCCESS [2:39.578s]
[INFO] DSpace OAI :: Web Application ......................... SUCCESS [43.201s]
[INFO] DSpace JSP-UI :: Web Application ...................... SUCCESS [3:26.257s]
[INFO] DSpace SWORD :: Web Application ....................... SUCCESS [1:22.040s]
[INFO] DSpace SOLR :: Web Application ........................ SUCCESS [17:28.865s]
[INFO] DSpace Assembly and Configuration ..................... SUCCESS [5:06.675s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 102 minutes 23 seconds
[INFO] Finished at: Wed Mar 09 06:57:19 PST 2011
[INFO] Final Memory: 40M/92M
[INFO] ------------------------------------------------------------------------

13. Change directory to Dspace source directory and run ant
cd /usr/src/dspace-1.7.0-release/dspace/target/dspace-1.7.0-build.dir
ant fresh_install

this will start a process, connecting database and updating a lot of files. Until you will see something like this:

     [echo] ====================================================================
     [echo]  The DSpace code has been installed, and the database initialized.
     [echo]  To complete installation, you should do the following:
     [echo]  * Setup your Web servlet container (e.g. Tomcat) to look for your
     [echo]    DSpace web applications in: /dspace/webapps/
     [echo]    OR, copy any web applications from /dspace/webapps/ to
     [echo]    the appropriate place for your servlet container.
     [echo]    (e.g. '$CATALINA_HOME/webapps' for Tomcat)
     [echo]  * Make an initial administrator account (an e-person) in DSpace:
     [echo]    /dspace/bin/dspace create-administrator
     [echo]  * Start up your servlet container (Tomcat etc.)
     [echo]  You should then be able to access your DSpace's 'home page':
     [echo]    http://localhost:8080/xmlui
     [echo]  You should also be able to access the administrator UI:
     [echo]    http://localhost:8080/xmlui/dspace-admin
     [echo] ====================================================================

Total time: 17 minutes 33 seconds

14. For your own sanity’s sake, instead of tweaking Tomcat as suggested by the installer, copy instead the DSpace webapps directory content to the Tomcat webapps directory.
cp -R /dspace/webapps/* /var/lib/tomcat6/webapps/

15. Create the initial administrator account.
cd bin
chmod 775 dspace
./dspace create-administrator

Creating an initial administrator account
E-mail address:
First name: xxxxxxx
Last name: xxxxxxx
WARNING: Password will appear on-screen.
Password: your_password
Again to confirm: your_password
Is the above data correct? (y or n): y
Administrator account created

16. Check if Tomcat is running. Launch your favorite web browser and go to cp

A webpage should say something like IT WORKS

17. Access your Dspace home page at

or access the administrator at

CONGRATULATIONS! You have successfully installed Dspace…