This process took me a lot of trial and error and many tutorials online were almost a decade old, so I decided to write this post. Please load the comments at the end of this post and let me know if this helped you!
When you see a '#' sign before a command, that means the command is expected to be run as a root user. By default FreeBSD does not have the sudo(8) command, so you will need to elevate yourself to root with `su - root`. If you're following along with a DigitalOcean droplet then sudo(8) is already provided for the freebsd user and you can simply prepend `sudo` to any commands with a '#' sign. If that command is piped to tee(1) then you need to place the sudo before tee (EX `printf 'some text\n' | sudo tee -a /some/file`).
If you want to follow along with this post with a DigitalOcean droplet, you can get a $10 credit here: https://m.do.co/c/3be924e7ec42. Full disclosure: this link also helps me out with DigitalOcean credit as well.
pkg install jenkins git-lite bash unzip android-tools-adb
mount -t fdescfs fdesc /dev/fd mount -t procfs proc /proc
printf 'fdesc /dev/fd fdescfs rw 0 0\n' | tee -a /etc/fstab printf 'proc /proc procfs rw 0 0\n' | tee -a /etc/fstab
If you're doing this on DigitalOcean you might want to check to see if procfs and fdescfs is already added to /etc/fstab and that the 'noauto' option is not set.
pkg install linux_base-c7
mount /compat/linux/proc mount /compat/linux/dev/shm
printf 'linprocfs /compat/linux/proc linprocfs rw 0 0\n' | tee -a /etc/fstab printf 'tmpfs /compat/linux/dev/shm tmpfs rw,mode=1777 0 0\n' | tee -a /etc/fstab
kldload linux kldload linux64
sysrc -f /boot/loader.conf linux_load="YES" sysrc -f /boot/loader.conf linux64_load="YES"
su - jenkins
mkdir -p "$HOME/secrets" keytool -genkeypair -keysize 2048 -keyalg RSA -alias jenkins -keystore "$HOME/secrets/keystore" exit
sysrc jenkins_args="--httpPort=-1 --httpsPort=8443 --httpsKeyStore=secrets/keystore --httpsKeyStorePassword=PASSWORD"
If you are going to use another service to manage certificates instead of Jenkins, you can skip the above two steps.
service jenkins start
printf 'REPO_OS_OVERRIDE=linux; export REPO_OS_OVERRIDE' | tee -a /etc/profile
After making changes to the /etc/profile, you need to logout and log back in for the environment variables to take effect.
mkdir -p /usr/local/share/android-sdk chown jenkins:jenkins /usr/local/share/android-sdk su - jenkins
cd /usr/local/share/android-sdk fetch https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip unzip sdk-tools-linux-3859397.zip ./tools/bin/sdkmanager --update
Accept the SDK license from the last command.
Install the build-tools and accept all licenses.
./tools/bin/sdkmanager "build-tools;26.0.0" ./tools/bin/sdkmanager --licenses
You can find which build tools version you need by examining the app/build.gradle file in the Android application folder. https://github.com/marblenix/HelloWorld/blob/master/app/build.gradle
You're done! For questions or comments please click View Comments below.
View Comments | Back to Blog | Back to Home