Skip to content

Instantly share code, notes, and snippets.

@robcowie
Created June 24, 2011 17:00
Show Gist options
  • Save robcowie/1045202 to your computer and use it in GitHub Desktop.
Save robcowie/1045202 to your computer and use it in GitHub Desktop.
Bootstrap a minimal install of FreeBSD
#!/usr/bin/env sh
##########
# /lang/python27 installs python 2.6.5 unless py27 is already installed
# /devel/py-lxml won't build with python2.7 installed
## Edit /JAILS/basejail/usr/ports/Mk/bsd.python.mk to add the following
## until python27 is correctly added to ports
## Python-2.7
#.elif ${PYTHON_VERSION} == "python2.7"
#PYTHON_PORTVERSION?=2.7.0
#PYTHON_PORTSDIR= ${PORTSDIR}/lang/python27
#PYTHON_REL= 270
#PYTHON_SUFFIX= 27
#PYTHON_VER= 2.7
# Create user pirc with adduser (http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/users-modifying.html)
# Set bash as login shell for root with chpass (R to edit at current position, :wq to exit, esc, then i to edit)
# Generate a key and pass to machines that require it
# ssh-keygen
# cat ~/.ssh/id_rsa.pub | ssh root@alcatraz1 "cat - >> ~/.ssh/authorized_keys"
# Supervisor conf is at /usr/local/etc/supervisord.conf
# Startup script is at /usr/local/etc/rc.d/supervisord
# see http://serverfault.com/questions/134179/how-do-i-automatically-start-supervisor-on-boot-in-freebsd
# Add the following to .profile
# # User specific aliases and functions
# bind '"\e[A"':history-search-backward
# bind '"\e[B"':history-search-forward
##########
portsnap fetch
portsnap extract
packages="\
/textproc/libxml2/ \
/shells/zsh/ \
/devel/py-lxml/ \
/net/rsync/ \
/lang/ruby \
/sysutils/screen/ \
/security/sudo/ \
/converters/unix2dos \
/sysutils/py-supervisor"
# /databases/mysql51-client/\
# /shells/zsh/\
echo "==> Installing curl"
cd /usr/ports/ftp/curl && make install clean
hash
echo "==> Installing python 2.7"
cd /tmp
curl -O http://python.org/ftp/python/2.7/Python-2.7.tgz
tar xzf Python-2.7.tgz
cd Python-2.7
./configure && make -j2 && make install
echo "==> bootstrapping server"
for i in $packages; do
echo " ==> Installing $i"
cd /usr/ports/$i && make install clean
hash
echo "========================================================================="
done
cd /tmp
echo "==> Installing ack"
curl http://betterthangrep.com/ack-standalone > /usr/local/bin/ack
hash
echo "==> Installing git"
curl -O http://kernel.org/pub/software/scm/git/git-1.7.5.2.tar.gz
tar xzf git-1.7.2.1.tar.gz && cd git-1.7.5.2
./configure --prefix=/usr/local
gmake && gmake install
hash
echo "==> Installing python libraries"
echo " ==> Installing easy_install"
curl http://peak.telecommunity.com/dist/ez_setup.py | python
echo " ==> Installing fabric"
cd /usr/ports/security/py-pycrypto/ && make install clean
easy_install -U fabric
hash
cd /tmp
echo " ==> Installing supervisor"
echo 'supervisord_enable="YES"' >> /etc/rc.conf
#easy_install -U supervisor
#sed -r -e "s/\;files = /etc/supervisor/\*\.ini/files = /etc/supervisor/\*\.ini/g /etc/supervisord.conf"
echo " ==> Getting virtualenv"
easy_install -U virtualenv
mkdir -p /usr/local/pythonenv && chmod 0755 /usr/local/pythonenv
hash
echo " ==> Getting pip"
easy_install -U pip
hash
## See http://www.bsdguides.org/guides/freebsd/misc/ntpd.php
# echo "==> Setting up ntpd"
# echo 'ntpd_enable="YES"' >> /etc/rc.conf
# echo 'ntpd_sync_on_start="YES"' >> /etc/rc.conf
# touch /var/db/ntpd.drift
# echo 'server pool.ntp.org prefer' >> /etc/ntpd.conf
# echo 'driftfile /var/db/ntpd.drift' >> etc/ntpd.conf
# echo 'restrict default ignore' >> /etc/ntpd.conf
# ntpd -c /etc/ntpd.conf -f /var/db/ntpd.drift
echo "==> Make /var/log/writable by wheel group"
chmod g+w /var/log
echo "==> Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment