Randr, Inc. Ubuntu 8.04 LTS Server Setup (Version 1.0)
We now have our instructions for Ubuntu 10.04 LTS and for the Randr eBusiness Suite Rental Portal and Web Business Suite using PPA. http://www.randrinc.com/jforum/posts/list/13998.page
This documentation covers setting up and configuring Ubuntu and middle-ware (Sun Java, PostgreSQL, Tomcat, and Apache) for a standalone web server to run our 2nd Derivative Portal Suites on. It is based on the reference documentation that our technicians use.
Please send us an questions, comments, or feedback. We greatly appreciate it.
Note: You will need to have the PC/server physically hooked up for internet access.
Tip: You can copy and paste the Linux commands into the terminal for easier installation.
Step 1: Installing Ubuntu
1. Download Ubuntu 8.04 LTS Server or Desktop Edition and burn to CD. We install the desktop edition to allow GUI based administration. Most of these steps will work with slight modification for the server edition.
2. Boot from CD into Ubuntu live environment.
3. Click on the Install icon on the desktop.
4. Proceed through install.
Step 2: Configure Ubuntu
1. Log into Ubuntu
2. Click Applications > Accessories > Terminal
3. Enter the following on the command prompt and press Enter:
Code:
4. Enter and re-enter a new password for the root user
Note: Make this password strong with a mix of uppercase letters, lowercase letters,
numbers, and special characters. For example: StR0n6_P4$sWoRd
Step 3: Updating Ubuntu and Configuring Package Repositories (Depending on your network speed, may take significant time)
1. Make sure you have a working network connection. Click Applications > Accessories >Terminal
2. Update the apt-get packages:
Code:
3. Update all the packages currently installed:
Code:
4. Enter the following on the command prompt and press Enter:
Code:
sudo apt-get install build-essential openssh-server openssh-client vim-full
5. Restart Ubuntu.
6. Log back in.
7. Then choose System > Administration > Update Manager.
8. Enter the same password you created for your account.
9. Once the Software Update window appears click on Check, then click on Install Updates. This will complete the update of your system to the most current version of the packages in this release.
Step 4: Install Webmin
1. Download the current debian package of webmin. http://www.webmin.com/download.html. It will be named webmin_<version>_all.deb.
2. Double-click webmin_<version>_all.deb
3. Follow the instructions on the screen.
4. Once the installation is finished open a web browser and browser to https://localhost:10000
5. Log in with the user account that you created on the Ubuntu installation.
Step 5: Set Up the Network
1. Open a web browser.
2. Browser to https://localhost:10000
3. Log in with the user account that you created on the Ubuntu installation.
4. Click Networking > Network Configuration > Network Interfaces
5. Under “Interfaces Active at Boot Time”, click eth0
6. Change the IP Address to Static and enter the IP address you want for the server (i.e.
192.168.0.100)
7. Enter the Netmask (i.e. 255.255.255.0)
8. Enter the Broadcast, this is generally the final .255 address in your domain (i.e 192.168.0.255)
9. Make sure “Active at Boot?” is set to yes.
10. Click Save and Apply
11. Make sure the “eth0” on the top and bottom of the Network Interface screen match
12. Click Module Index link at the top of the screen
13. Click Routing and Gateways
14. Under Routing configuration activated at boot time, click the radial button next to “Gateway”
15. Enter the Gateway of your network in the box.
16. Make sure that devise is “eth0”
17. Click Save
18. Click Module Index link at the top of the screen
19. Click Hostname and DNS Clients
20. In the Hostname box enter the hostname for you server (i.e. www.yoururl.com or
ebiz.yoururl.com, etc)
21. Click Save
22. Click Module Index link at the top of the screen
23. Click Host Addresses
24. Check to make sure the the hostname you entered above has the same IP address as the server
25. If it does click the IP address and enter the IP address of the server and click Save
26. Click Module Index link at the top of the screen
27. Click the Apply Configuration button
Step 6: Installing PostgreSQL
1. In Synaptic, search for postgresql. Check and mark, postgresql-8.3 and postgres-server-dev-8.3 for
installation(accept dependencies).
2. In Synaptic, search for pgadmin3. Check pgadmin3 and mark for installation(accept
dependencies).
3. Click on the Apply button at the top.
4. Click Applications > Accessories > Terminal.
5. Enter the following commands on the command prompt and press Enter after each one (replace *password* with your password, remember to make it a strong password):
Code:
sudo su postgres -c psql template1
ALTER USER postgres WITH PASSWORD '*password*';
\q
* Note : template1 as in template one.
6. The following step are necessary to remotely access the PostgreSQL server. We find it useful for running pgAdmin3 on laptops to administer the database or to use a database on the server for development.
Code:
sudo gedit /etc/postgresql/8.3/main/postgresql.conf
Change the following lines, watch the # signs in front. => means change to:
Code:
#listen_addresses = 'localhost' => listen_addresses = '*'
Save the file. This tells postgresql to listen for connections from anywhere, not just this server.
Code:
sudo gedit /etc/postgresql/8.3/main/pg_hba.conf
Match the following:
Code:
# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database
# super user can access the database using some other method.
# Noninteractive
# access to all databases is required during automatic maintenance
# (autovacuum, daily cronjob, replication, and similar tasks).
#
# Database administrative login by UNIX sockets
local all postgres ident sameuser
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 0.0.0.0 0.0.0.0 md5
# "local" is for Unix domain socket connections only
local all all ident sameuser
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
Save the file. This tells postgresql to allow connections from anywhere with proper password.
7. We recommend setting up PostgreSQL to auto vacuum and analyze to keep the database in top shape.
Code:
sudo gedit /etc/postgresql/8.3/main/postgresql.conf
Change the following lines, watch the # signs in front.
Code:
superuser_reserved_connections = 3
track_counts = on
autovacuum = on
log_autovacuum_min_duration = -1
autovacuum_max_workers = 3
autovacuum_naptime = 1min
autovacuum_vacuum_threshold = 50
autovacuum_analyze_threshold = 50
autovacuum_vacuum_scale_factor = 0.2
autovacuum_analyze_scale_factor = 0.1
autovacuum_freeze_max_age = 200000000
autovacuum_vacuum_cost_delay = 20
autovacuum_vacuum_cost_limit = -1
Save the file.
8. Restart postgreSQL. Open terminal and enter:
Code:
/etc/init.d/postgresql-8.3 restart
Step 7: Installing Sun Java (change from previous no longer requires a update-alternatives since java was open sourced)
1. In Synaptic, search for sun-java5-jdk. Check sun-java5-jdk and mark for installation(accept
dependencies).
2. Click on the Apply Icon at the top of Synaptic.
3. Agree to Terms and click Forward.
4. Open a terminal and execute the following command to correct a java issue affecting graphics:
Code:
sudo ln -s /usr/lib/jvm/java-1.5.0-sun/jre/lib/i386/libmlib_image.so /usr/lib
See our forum for more details about this fix (http://www.randrinc.com/jforum/posts/list/58.page).
Step 8: Installing Tomcat
1. In Synaptic, search for Tomcat5.5. Check and mark tomcat5.5, tomcat5.5-admin, and tomcat5.5-webapps for installation(accept dependencies).
2. Click on the Apply button at the top of Synaptic.
3. Click Applications > Accessories > Terminal.
4. Enter the following on the command prompt and press Enter:
Code:
sudo gedit /etc/default/tomcat5.5
Change the following lines, be sure to remove the # in the front:
Code:
JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
TOMCAT5_SECURITY=no
Save the file.
5. Enter the following on the command prompt and press Enter:
Code:
sudo gedit /var/lib/tomcat5.5/conf/tomcat-users.xml
Change the file to look like this, but change the passwords to strong passwords:
Code:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="tomcat,admin,manager"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>
Save the file.
6. Edit /var/lib/tomcat5.5/conf/context.xml, remove the <!-- --> around <Manager pathname=””> .
Code:
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
7. Download activation.jar and mail.jar (available from server components or webapp project) to the Desktop (note from Ann, see the post below from Cary for a link to download these files. Thanks Cary)
8. Copy the Jar files into /var/lib/tomcat5.5/shared/lib:
Code:
Press Enter
Enter the following command for each file:
Code:
sudo cp (jar file name) /var/lib/tomcat5.5/shared/lib
Press Enter
9. Change the ownership of the jar files:
Code:
cd /var/lib/tomcat5.5/shared/lib
Enter the following command for each file:
Code:
chown tomcat55:nogroup (jar file name)
10. Enter the following command on the command prompt and press Enter
Code:
sudo /etc/init.d/tomcat55 start
11. Open a brower and go to http://localhost:8180 to make sure the installation is successful. You should see a tomcat start page. Depending on your server size, it could take Tomcat a few minutes to finish starting.
Step 9: Installing Apache
1. Click Applications > Accessories > Terminal.
2. Enter the following on the command prompt and press Enter:
Code:
sudo apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libapr1 libexpat1 ssl-cert
3. Install the Apache-Tomcat Connecter. From the terminal run the following:
Code:
apt-get install libapache2-mod-jk
sudo gedit /etc/libapache2-mod-jk/workers.properties
Change the entries to look like:
Code:
workers.tomcat_home=/usr/share/tomcat5.5
workers.java_home=/usr/lib/jvm/java-1.5.0-sun
Save the file and exit gedit.
Code:
You will be prompted for the Root Password
Code:
cat /usr/share/doc/libapache2-mod-jk/httpd_example_apache2.conf >> /etc/apache2/apache2.conf
4. Enter the following commands on the command prompt and press Enter after each one:
Code:
sudo a2enmod ssl
sudo a2enmod rewrite
sudo a2enmod suexec
sudo a2enmod include
sudo a2enmod jk
5. Enter the following on the command prompt and press Enter:
Code:
sudo /etc/init.d/apache2 force-reload
6. Open a brower and go to http://localhost/jsp-examples/jsp2/simpletag/hello.jsp to make sure the installation is successful. You should see a page that says "Hello World".
Step 10: Installing Randr 2nd Derivative Portal Suites: Web Business Suite and eBusiness Suite
Click here for installation instructions
Update Recommendations
For a production server, we recommend caution updating the operating system and packages, too often an untested update will break the server or applications. You should have a second server. We recommend setting it up identically as a test environment. Applying the updates to it and test everything on it, before applying any changes to the production server. Without a test environment we recommend foregoing upgrades.
Common Commands you will need
Starting and stopping Apache
Code:
sudo /etc/init.d/apache2 start
sudo /etc/init.d/apache2 stop
Starting and stopping Tomcat
Code:
sudo /etc/init.d/tomcat55 start
sudo /etc/init.d/tomcat55 stop
Note: Best practices for restarting the application – stop Apache, stop Tomcat, wait a few minutes, start Tomcat, wait a few minutes, start Apache.
Starting and stopping PostgreSQL
Code:
sudo /etc/init.d/posgresql-8.3 start
sudo /etc/init.d/postgresql-8.3 stop
or through the webmin GUI.
Troubleshooting
Fit Ubuntu desktop to your monitor:
1. Click Applications > Accessories > Terminal.
2. Enter the following on the command prompt and press Enter:
Code:
sudo dpkg-reconfigure xserver-xorg
3. In the window that pops up take all the defaults.
4. Restart Unbuntu
Configuring your URL to go to the Order Portal on your server:
1. Go to www.2d-orderportal.com
2. Click on How To's in the menu
Configuring a paid SSL (i.e. - Verisign, etc.) in Ubuntu:
1. Go to www.2d-orderportal.com
2. Click on How To's in the menu
References (most are from previous 6.06 LTS setup, this setup was adaptation and experimentation):
PostgreSQL installation - http://hocuspok.us/journal/postgresql-on-ubuntu-linux-how-to-updated
PostgreSQL installation - http://weblogs.java.net/blog/cayhorstmann/archive/2006/07/installing_glas.html
Sun Java installation - http://weblogs.java.net/blog/cayhorstmann/archive/2006/07/installing_glas.html
Sun Java installation - http://blixtra.org/blog/2006/07/14/setting-up-tomcat-5-on-ubuntu-606/
Apache Tomcat Installation - http://blixtra.org/blog/2006/07/14/setting-up-tomcat-5-on-ubuntu-606/
Apache and PHP Installation - http://www.howtoforge.com/perfect_setup_ubuntu_6.06_p6