In this post I’ll show how to install Atlassian Jira on FreeBSD. This is just a proof of concept. I wouldn’t recommend running this in production as it’s not supported. I would also recommend to have a dedicated FreeBSD server for this. There are a lot of non-standard changes in order this to work.
Jira runs on Java and OpenJDK is not supported, so we’ll have to use Oracle Java on FreeBSD and according to the port maintainers, this is not a stable port. These are the prerequisites.
- FreeBSD 10.3 or greater
- Atlassian Jira 7.2.4
- Oracle JRE 8u112
- MySQL-Connector for Java 5.1.40
Go to this website and download the version highlighted.You have to accept the license agreement first.
Java JDBC connector for MySQL
Go to this web site and download the version highlighted.
Go to this web site and download the generic tarball.
This is what I have under /tmp
ls -l *.tar.gz [email protected]:/tmp # ls -l *.tar.gz -rw-r--r-- 1 ec2-user ec2-user 264894180 Dec 3 00:48 atlassian-jira-software-7.2.4.tar.gz -rw-r--r-- 1 ec2-user ec2-user 76262744 Dec 3 00:23 jre-8u112-linux-i586.tar.gz -rw-r--r-- 1 ec2-user ec2-user 3911557 Dec 3 00:01 mysql-connector-java-5.1.40.tar.gz
Enable Linux compatibility
I’ll use the 64-bit Linux kernel module and I need FreeBSD 10.3 for that. You can use the 32-bit if you want and any version of FreeBSD if you want. Instead of linux64, use linux.
Check if the module loaded correctly.
You should see something like this.
2 1 0xffffffff81c11000 382bd linux64.ko
Execute these three lines.
printf "compat.linux.osrelease=2.6.18\n" >> /etc/sysctl.conf sysctl compat.linux.osrelease=2.6.18 pkg install –y linux_base-c6
Then edit /etc/rc.conf and enable the Linux module to start on each boot.
Java, bash and Linux module require some special file systems, so edit /etc/fstab and add these lines.
linprocfs /compat/linux/proc linprocfs rw 0 0 tmpfs /compat/linux/dev/shm tmpfs rw,mode=1777 0 0 fdesc /dev/fd fdescfs rw 0 0
Finally install bash, create a symbolic link and reboot.
pkg install –y bash cd /bin ln -s /usr/local/bin/bash reboot
Install Java from ports
cd to /usr/ports. If you don’t have the ports installed, do portsnap fetch && portsnap extract first.
If it fails do
portsnap fetch && portsnap extract
Create the /usr/ports/distfiles if you don’t have that folder.
mkdir /usr/ports/distfiles cd /usr/ports/distfiles
Copy the Java tarball from the /tmp directory and install Java
cp /tmp/jre-8u112-linux-i586.tar.gz . cd /usr/ports/java/linux-oracle-jre18 make all install clean
You’ll see this warning
Warning: This JRE may be unstable. You are advised to use the native FreeBSD 1.8 JDK, in ports/java/openjdk8.
As I said earlier, Jira does not support OpenJDK.
You don’t want to run Jira as root, so we’ll create an user for that.
Type adduser and accept the defaults for everything except the lines below.
adduser Username: jirauser Full Name: Atlassian Jira Shell: bash Enter password: Re-enter password: OK? Yes Add another user? no
Now log as the jirauser
su - jirauser
Edit the .profile file, uncomment the PATH directive and add the bin directory for Jira. In addition, create two variables for JAVA_HOME and JIRA_HOME. My .profile looks like this.
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:$HO ME/bin:/usr/local/linux-oracle-jre1.8.0/bin; export PATH # BLOCKSIZE=K; export BLOCKSIZE JAVA_HOME=/usr/local/linux-oracle-jre1.8.0; export JAVA_HOME JIRA_HOME=/usr/local/etc/jirasoftware-home; export JIRA_HOME
Once completed, exit from the jirauser session by typing exit. You should be back as root.
As root execute these commands to create the directory for Jira, copy the tarball there, extract the tarball, delete it and own the directory structure by the jirauser.
cd /usr/local mkdir jirasoftware && cd jirasoftware cp /tmp/atlassian-jira-software-7.2.4.tar.gz . tar xzvf atlassian-jira-software-7.2.4.tar.gz rm atlassian-jira-software-7.2.4.tar.gz chown -R jirauser:jirauser atlassian-jira-software-7.2.4-standalone/ chmod -R u=rwx,go-rwx atlassian-jira-software-7.2.4-standalone/
Create another directory for Jira, this is where some settings are stored.
cd /usr/local/etc mkdir jirasoftware-home chown -R jirauser /usr/local/etc/jirasoftware-home chmod -R u=rwx,go-rwx /usr/local/etc/jirasoftware-home
Install MySQL by executing
pkg install -y mysql56-server
Edit /etc/rc.conf and add this line.
Start the MySQL service.
service mysql-server start
Then do some initial configurations for the root password.
Accept the defaults for everything except when you change your root password (for the DB sys owner, not the OS root password).
Then create the database for Jira.
mysql –u root –p
Enter the MySQL root password and execute these commands under mysql prompt.
create database jiradb character set utf8 collate utf8_bin; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on jiradb.* TO 'jirauser'@'localhost' IDENTIFIED BY 'yourjirapassword'; flush privileges; exit
Log to MySQL as the jirauser database user.
mysql -u jirauser -p
SHOW GRANTS FOR [email protected]; exit
You should see the same result as the grant command above. Log back to MySQL as root.
mysql -u root -p
show variables like 'default_storage_engine'; //DO NOT TYPE THIS: InnoDB is OK show variables like 'max_allowed_packet'; //DO NOT TYPE THIS: 4194304 is default show variables like 'innodb_log_file_size'; //DO NOT TYPE THIS: 50331648 is default show variables like 'sql_mode'; //DO NOT TYPE THIS: STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION is default exit
Jira requires different values for max_allowed_packet and innodb_log_file_size, so we’ll change that.
Edit /usr/local/my.cnf and add these two lines at the end.
Restart MySQL with
service mysql-server restart
We’ll have to extract the tarball first.
cd /tmp tar xzvf mysql-connector-java-5.1.40.tar.gz
Then copy the jar archive to the lib folder under Jira.
cd /usr/local/jirasoftware/atlassian-jira-software-7.2.4-standalone/lib cp /tmp/mysql-connector-java-5.1.40/mysql-connector-java-5.1.40-bin.jar . chown jirauser:jirauser mysql-connector-java-5.1.40-bin.jar
Log as jirauser with su – jirauser and then start Jira.
cd /usr/local/jirasoftware/atlassian-jira-software-7.2.4-standalone/bin ./start-jira.sh
It’s gonna tell you something like Server startup logs are located in /usr/local/jirasoftware/atlassian-jira-software-7.2.4-standalone/logs/catalina.out
In a browser go to : http://yourserver:8080
Choose the second option “I’ll set it up myself”
Fill up the form with the values that you’ve specified when you created the database.
Click on Test Connection and make sure it says it’s OK.
Once the DB connections is OK, click Next. You’ll see a lot of activity in the catalina.out log file.
After 2-5 mins, you’ll see this screen. Fill up the form to suit your needs.
Jira requires a license key. I don’t have one so I’ll generate a trial one. Click on the link where it says “generate a JIRA trial license”. You’ll be redirected to their site. Create an account or you can use a Google account.
Once you generate a trial license key, you’ll see the license in the license text box. Click Nex to setup the admin account.
I am not interested in the e-mail notifications at this time, so I’ll choose “Later”.
A couple of some more questions…
And you are all set!