Archive

Archive for April, 2011

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…

CREATING THE DEBIAN 6.0 VIRTUAL MACHINE (VM)

  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.

INSTALL DEBIAN 6.0 (SQUEEZE)

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 mshome.net 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.
    Note:
    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.

SETTING UP THE 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…

THE TRY-IT-OUT STAGE
Host PC:
Lenovo 3000
CPU Intel Centrino 1.66GHz
RAM 2.99GB usable
HDD 320GB
OS Windows 7 32bit Ultimate

Virtual Machine:
Hypervisor Oracle VirtualBox 4.0.4r70112
RAM 384MB
HDD 10GB
Audio Disabled
Network Bridged
OS Debian 6.0 (Squeeze)
Hostname dspace
Network DHCP reservation

DSPACE INSTALLATION

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 sourceforge.net so I downloaded the package here.
Before downloading, change directory to /usr/src
cd /usr/src/
Then download the package
wget -c http://www.sfr-fresh.com/unix/www/dspace-1.7.0-release.tar.gz

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

# TYPE DATABASE USER CIDR-ADDRESS METHOD
# “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.your-domain-name.edu

# DSpace base host URL
dspace.baseUrl = http://dspace.your-domain.edu:8080 or http://ip_address:8080

NOTE
– 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
dspace.xxxxxx.edu. 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.name — Dspace for AIIAS Hardinge Library

# Database name (“oracle”, or “postgres”)
#db.name = ${default.db.name} <<< comment this entry
db.name = postgres <<< uncomment this
#db.name = 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 = smtp.your-domain.edu

# From address for mail
mail.from.address = dspace-noreply@your-domain.edu

# Currently limited to one recipient!
feedback.recipient = dspace-help@your-domain.edu

# General site administration (Webmaster) e-mail
mail.admin = dspace-help@your-domain.edu

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

BUILD SUCCESSFUL
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: xxxxxxx@xxxxx.edu
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
http://dspace_server_address:8080

A webpage should say something like IT WORKS

17. Access your Dspace home page at
http://dspace_server_address:8080/jspui

or access the administrator at
http://dspace_server_address:8080/jspui/dspace-admin

CONGRATULATIONS! You have successfully installed Dspace…