1. Install java
% cd /usr/ports/java/jdk16
% make
Installing java on freebsd is not fully automated, you will be prompted to download files
IMPORTANT: To build the JDK 1.6.0 port, you should have at least
2.5Gb of free disk space in the build area!
Due to licensing restrictions, certain files must be fetched manually.
Please download the Update 3 Source from
http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-src-b05-jrl-24_sep_2007.jar
and the Source Binaries from
http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-bin-b05-jrl-24_sep_2007.jar
and the Mozilla Headers from
http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-mozilla_headers-b05-unix-24_sep_2007.jar
.
Please open http://www.oracle.com/technetwork/java/javase/downloads/index.html
in a web browser and follow the "Download" link for
"JDK DST Timezone Update Tool - 1_3_45" to obtain the
time zone update file, tzupdater-1_3_45-2011n.zip.
Please download the patchset, bsd-jdk16-patches-4.tar.bz2, from
http://www.eyesbeyond.com/freebsddom/java/jdk16.html.
Please place the downloaded file(s) in /usr/ports/distfiles
and restart the build.
*** Error code 1
Stop in /usr/ports/java/jdk16.
*** Error code 1
Stop in /usr/ports/java/jdk16.
*** Error code 1
These files are:
% cd /usr/ports/distfiles
% wget http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-src-b05-jrl-24_sep_2007.jar
% wget http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-bin-b05-jrl-24_sep_2007.jar
% wget http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-mozilla_headers-b05-unix-24_sep_2007.jar
% # download manually tzupdater-1_3_45-2011n.zip from http://www.oracle.com/technetwork/java/javase/downloads/index.html
% # download manually bsd-jdk16-patches-4.tar.bz2 from http://www.eyesbeyond.com/freebsddom/java/jdk16.html
2. Run make
% cd /usr/ports/java/jdk16
% make
% make install
3. Install geoserver
% cd /usr/ports/graphics/geoserver
% make
% make install
4. Startup geoserver
% vim /etc/rc.conf
geoserver_enable=YES
% /usr/local/etc/rc.d/geoserver start
5. Browse http://127.0.0.1:8080/geoserver/
1. Install apache22
% cd /usr/ports/www/apache22
% make config
% make install clean
% vim /etc/rc.conf
apache22_enable=YES
/usr/local/etc/rc.d/apache22 start
2. Install php52
% cd /usr/ports/lang/php52
% make config #enable APACHE module
% make
% make install clean
Installing PHP CLI binary: /usr/local/bin/
Installing PHP CLI man page: /usr/local/man/man1/
Installing PHP CGI binary: /usr/local/bin/
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/include/php/
Installing helper programs: /usr/local/bin/
program: phpize
program: php-config
....
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/apache22/libphp5.so
/usr/local/bin/php
/usr/local/bin/php-cgi
...

3 Configure Apache for php
% vim /usr/local/etc/apache22/httpd.conf
LoadModule php5_module libexec/apache22/libphp5.so
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
<IfModule mime_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>
1. Install apache22
% cd /usr/ports/www/apache22
% make config
% make install clean
% vim /etc/rc.conf
apache22_enable=YES
/usr/local/etc/rc.d/apache22 start
2. Install rvm via multi user install from http://beginrescueend.com/rvm/install/
Login as root.
% bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 799k 100 799k 0 0 109k 0 0:00:07 0:00:07 --:--:-- 199k
Installing RVM to /usr/local/rvm/
RVM system user group 'rvm' exists, proceeding with installation.
# RVM: Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.beginrescueend.com/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Screencast: http://screencasts.org/episodes/how-to-use-rvm
# In case of any issues read output of 'rvm requirements' and/or 'rvm notes'
Installation of RVM in /usr/local/rvm/ is almost complete:
* First you need add all users that will be using rvm to 'rvm' group,
anyone using rvm will be operating with `umask g+w`.
* To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.
* Optionally you can run `rvm tools rvm-env ruby bash` which will generate
shebang wrappers for easier selecting ruby in scripts.
# root,
#
# Thank you for using RVM!
# I sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne
3. Add your users to rvm group
# vim /etc/group
....
rvm:*:1003:root,rupert
Load rvm script to current shell by calling source /etc/profile.d/rvm.sh or add it to /etc/profile and re-login
#vim /etc/profile
source /etc/profile.d/rvm.sh
After relogging in, simply type rvm and it should spit out something. If the command is not found, then you are doing something wrong.
4. Install 1.9.3
% rvm install 1.9.3
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)...
ruby-1.9.3-p0 - #fetching
ruby-1.9.3-p0 - #downloading ruby-1.9.3-p0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
3 8604k 3 340k 0 0 27173 0 0:05:24 0:00:12 0:05:12 64100
Use ruby1.9.3
% rvm --default use 1.9.3-p0
% gem install bundler -V
5. Install passenger3
This will install system wide passenger gem which is installed on 1.9.3-p0 gemset.
% gem install passenger -V
% cd /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11/bin
% ./passenger-install-apache2-module
--------------------------------------------
The Apache 2 module was successfully installed.
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p0/ruby
After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!
Press ENTER to continue.
--------------------------------------------
Deploying a Ruby on Rails application: an example
Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
<VirtualHost *:80>
ServerName www.yourhost.com
DocumentRoot /somewhere/public # <-- be sure to point to 'public'!
<Directory /somewhere/public>
AllowOverride all # <-- relax Apache security settings
Options -MultiViews # <-- MultiViews must be turned off
</Directory>
</VirtualHost>
6. Edit httpd.conf to load the passenger module
To use a rvm gemset by passenger read “Rails app with custom .rvmrc and a system wide passenger install” https://rvm.beginrescueend.com/integration/passenger/
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p0/ruby
<VirtualHost 192.168.69.3:80>
ServerAdmin rupert@2rmobile.com
ServerName myserver
ServerAlias myserver
DocumentRoot "/path/to/myapp/public"
<Directory "/path/to/myapp/public">
#DocumentRoot "/path/to/myapp/current/public"
#<Directory "/path/to/myapp/current/public">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
CustomLog /var/log/apache22/myapp-error.log combinedio
LogLevel warn
</VirtualHost>
We need a railsapp/config/setup_load_paths.rb to use our custom .rvmrc
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."
end
end
# Pick the lines for your version of Bundler
# If you're not using Bundler at all, remove all of them
# Require Bundler 1.0
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
require 'bundler/setup'
# Require Bundler 0/9
# if File.exist?(".bundle/environment.rb")
# require '.bundle/environment'
# else
# require 'rubygems'
# require 'bundler'
# Bundler.setup
# end
Visit this stackoverflow question http://stackoverflow.com/questions/5680341/how-to-load-passenger-from-apache-with-rvm-and-unique-gem-sets
% git clone rupert@server:/path/to/your/myapp.git
% cd myapp
9. Run bundle
% bundle install -V
Fetching source index for http://rubygems.org/
....
Errors that you may encounter
Note: The rvmrc located in ‘../releases/20120208034235′ could not be loaded, likely due to trust mechanisms. Please run ‘rvm rvmrc {trust,untrust} “../releases/20120208034235″‘ to continue, or set rvm_trust_rvmrcs_flag to 1. (RVM::ErrorLoadingRVMRC)
% vim /etc/rvmrc
umask g+w
rvm_trust_rvmrcs_flag=1
1. install git server
$ cd /usr/ports/devel/git
$ make install clean
Note: Include gitweb as an option
2. Modify /etc/rc.conf
git_daemon_enable="YES"
git_daemon_directory="/var/db/git/repo"
git_daemon_flags="--export-all --syslog --enable=receive-pack --listen=ip_address --verbose"
3. Create git user
$ pw user add git
$ passwd git
$ chsh git
Login: git
Password: *******************
Uid [#]: 1002
Gid [# or name]: 1002
Change [month day year]:
Expire [month day year]:
Class:
Home directory: /var/db/git
Shell: /usr/local/bin/git-shell
Full Name: User &
Office Location:
Office Phone:
Home Phone:
Other information:
“git” user would create repositories. We could also add “rupert” to the git group.
pw user mod rupert -G git
4. Let’s create a repository
$ cd /var/db/git/repo
$ sudo mkdir cws-rails.git
$ cd cws-rails.git/
$ sudo git --bare init
Initialized empty Git repository in /var/db/git/repo/cws-rails.git/
$ cd ..
$ ls -l
total 4
drwxr-xr-x 7 root git 512 Nov 16 12:54 cws-rails.git
drwxrwxr-x 7 git git 512 Nov 16 11:52 myproject.git
$ sudo chown -Rf git:git cws-rails.git
$ sudo chmod -Rf 775 cws-rails.git
Make sure to change the ownership to git. We also make it writable to the group so users like rupert will have write access.
5. Let’s clone, commit and push
So now in my MBP, i will clone myproject.git, change some file and push.
$ git clone rupert@rupert-bsd:/var/db/git/repo/myproject.git
Cloning into myproject...
Password:
remote: Counting objects: 12, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 12 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (12/12), done.
~/Desktop/myproject[master]% gc -m "Updated CHANGELOG" CHANGELOG
[master d9fd0f7] Updated CHANGELOG
1 files changed, 1 insertions(+), 0 deletions(-)
~/Desktop/myproject[master]% git push
Password:
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 332 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To rupert@rupert-bsd:/var/db/git/repo/myproject.git
5d16498..d9fd0f7 master -> master
Note: So that we don’t need to specify the password all the time, generate an ssh-keygen -t rsa for id_rsa.pub and append it to rupert@rupert-bsd:/home/rupert/.ssh/authorized_keys
6. Setup Git, Configure and Restart Apache2
# Copy the gitweb directory to your apache22 directory
$ sudo cp -Rf /usr/local/share/examples/git/gitweb /usr/local/www/apache22/data/
# Edit gitweb.cgi to point to your repo
$ vim /usr/local/www/apache22/data/gitweb/gitweb.cgi
our $projectroot = "/var/db/git/repo";
# Allow apache to execute gitweb.cgi
Alias /gitweb /usr/local/www/apache22/data/gitweb
<Directory /usr/local/www/apache22/data/gitweb>
Options FollowSymLinks +ExecCGI
AddHandler cgi-script .cgi
</Directory>
Browse http://servername/gitweb/gitweb.cgi