This is a tutorial to remote Install FreeBSD with ZFS for LUSCA HEAD proxy server. The ISO file that we using is from mfsBSD where we could find the complete ISO mfsBSD all version too.
- Set Mikrotik as DHCP server, define the port which use for server, set IP and just use subnetmask 30
- add rule on firewall NAT to forward the IP from internet to the server box
- Burn the ISO file, choose the correct one, and add the person near with server to ensure the server booting up from the CD
- check the log on Mikrotik box to ensure the server has already given the IP address by Mikrotik box
after all of above step success, now remote the server by using SSH or putty if you remote it from windows box. the default password is mfsroot while the user is root. Now, type the following command;
- Erase the HDD Data’s server, destroy all data.
# gpart destroy -F ad4
- mounting the cdrom
# mount_cd9660 /dev/acd0 /cdrom
- Install the FreeBSD with ZFS support
# zfsinstall -d /dev/ad4 -t /cdrom/8.2-RELEASE-i386.tar.xz -s 4G -V 15
if your server using AMD/Intel 64bit
# zfsinstall -d /dev/ad4 -t /cdrom/8.2-RELEASE-amd64.tar.xz -s 4G -V 15
Please wait until the process finish, than we need edit some files to ensure after reboot the server, server ready to the next step.
# chroot /mnt
# passwd root < === enter a new password
- enabling remote access through SSH
# ee /etc/ssh/sshd_config
find the following line
#PermissionRootLogin no
edit to become like below
PermissionRootLogin yes
Now, we configure the network for the server and ensure it match with existing network
# echo 'defaultrouter="192.168.2.1"' >> /etc/rc.conf
# echo ‘gateway_enable=”YES”‘ >> /etc/rc.conf
# echo ‘hostname=”proxy43″‘ >> /etc/rc.conf
# echo ‘ifconfig_fxp0=”inet 192.168.2.2 netmask 255.255.255.0″‘ >> /etc/rc.conf
# echo ‘sshd_enable=”YES”‘ >> /etc/rc.conf
# echo ‘nameserver 192.168.2.1′ >> /etc/resolv.conf
fxp0 is ethernet network card that detected by server. Please change if your network card has different name. just type “ifconfig”. Please change the hostname with your desire name. Than after finish, just reboot the server.
# reboot
Ensure the CD has been taken from CDROM and boot directly from HDD. If success, you will have login prompt. Now, we need to remote the server to install and configure before release it for production. Okay, let’s continue with some following command. But before we continue, just ensure you could successfully remote the server. for my case, I use putty.
- Install LUSCA HEAD
# cd /tmp
# pkg_add -rv perl
# rehash
# fetch http://simplyeko.com/lusca/LUSCA_HEAD-14809STABLE/LUSCA_HEAD.tar.bz2
# tar xzvf LUSCA_HEAD.tar.bz2
- Compile LUSCA
# make clean
# ./configure –prefix=/usr –exec-prefix=/usr –bindir=/usr/sbin –sbindir=/usr/sbin –libexecdir=/usr/libexec/squid –sysconfdir=/usr/local/etc/squid –localstatedir=/var/log/squid –datadir=/usr/share/squid –enable-async-io=24 –with-aufs-threads=24 –with-pthreads –enable-storeio=aufs,coss,null –disable-linux-netfilter –enable-kqueue –enable-arp-acl –disable-linux-tproxy –disable-epoll –enable-removal-policies=heap –with-aio –with-dl –enable-snmp –enable-delay-pools –enable-htcp –enable-cache-digests –disable-unlinkd –enable-large-cache-files –with-large-files –enable-err-languages=English –enable-default-err-language=English –with-maxfd=65536
# make && make install
# rehash
Create partition for cache, since the FreeBSD server has already support ZFS. No need to define the volume size of cache parttion.
# zfs create -o atime=off tank/root/cache1
# zfs create -o atime=off tank/root/cache2
Check again to ensure the /cache1 and /cache2 has already created by typing the following command
#df -h
proxy43# df -h
Filesystem Size Used Avail Capacity Mounted on
tank/root 288G 449M 288G 0% /
devfs 1.0K 1.0K 0B 100% /dev
tank/cache1 288G 562M 288G 0% /cache1
tank/cache2 288G 556M 288G 0% /cache2
tank/root/tmp 288G 44M 288G 0% /tmp
tank/root/var 288G 12M 288G 0% /var
Now, we continue to configure LUSCA to run properly on the FreeBSD with ZFS.
# touch /var/log/squid/access.log
# touch /var/log/squid/cache.log
# chown -R proxy:proxy /var/log/squid/*
# chown -R proxy:proxy /cache*
Now, fetch following files to correct destination directory. These are the configuration file and need some adjustment to match with your current network.
- Fetch squid.conf and refresh.conf to /usr/local/etc/squid
# cd /usr/local/etc/squid
# fetch http://simplyeko.com/lusca/LUSCA_HEAD-14809STABLE/lusca_config/squid.conf
# fecth http://simplyeko.com/lusca/LUSCA_HEAD-14809STABLE/lusca_config/refresh.conf
- Fetch storeurl.pl to /usr/share/squid
# cd /usr/share/squid
# fetch http://simplyeko.com/lusca/LUSCA_HEAD-14809STABLE/lusca_config/storeurl.pl
UPDATE: # fetch http://simplyeko.com/lusca/LUSCA_HEAD-14809STABLE/lusca_config/storeurl.txt
than rename to storeurl.pl, chmod the file if needed
# chmod +x storeurl.pl
- Fetch squid.sh to /usr/local/etc/rc.d/
# cd /usr/local/etc/rc.d
# fetch http://simplyeko.com/lusca/LUSCA_HEAD-14809STABLE/lusca_config/squid.sh
One again, check squid.conf file and do necessary adjustment to match with your network requirement. Now, we continue to final touch before the squid LUSCA HEAD ready to release for production
# chmod +x /usr/share/squid/storeurl.pl
# chmod +x /usr/local/etc/rc.d/squid.sh
# squid -z
# squid -k parse
# /usr/local/etc/rc.d/squid.sh start
# sockstat -4
Done, now you could use the server as proxy server to serve your client. I have to write this as backup and remind me how to install. Next, I will share how to install,setup and configure squidstats as graph monitoring for LUSCA HEAD squid proxy server.
Greetings friend the link fetch http://simplyeko.com/lusca/LUSCA_HEAD-14809STABLE/lusca_config/storeurl.pl that there does not download any specific file. If I can provide the file for test planting scheme. Thanks in advance
Oups.. I will check than e-upload the file once I get back my laptop.
GR8 tutorial dude, very well presented but I am having the same problem cannot find the soreurl.pl please re-upload I am in the middle of configuration. Thanks a lot.
I got the file storeurl.pl from another location but squid does not run. It gives the following error in messages. Can u please help?
Aug 15 17:12:30 proxy squid[15478]: Squid Parent: child process 15496 started
Aug 15 17:12:30 proxy squid[15496]: The store_rewriter helpers are crashing too rapidly, need help!
Aug 15 17:12:30 proxy squid[15478]: Squid Parent: child process 15496 exited due to signal 6
Aug 15 17:12:30 proxy kernel: pid 15496 (squid), uid 62: exited on signal 6
Gazi Shamim : please check your inbox.
I just send the file to your email address.
btw, I just re-upload the file through ftp client but not sure why if download through browser, it is like empty file.
okay, I’ve just re-upload storeurl.pl but I just rename the file to TXT. Please save as/rename to storeurl.pl than chmod the file.
Thanks a lot. You are a life saver. The error has been resolved. It is currently running smoothly in my ISP’s production server.
udah dicoba dan berhasil, tapi kok ngga bisa cache youtube ya? streaming ulang terus.
coba ambil squid.conf, storeurl.pl, tunning.conf, dan refresh.conf dari tutor di http://simplyeko.com/install-lusca-proxy-server-in-freebsd-9.html
dah bisa jalan normal, tapi kok belum bisa cache youtube yg versi baru ya….boleh minta file squid.conf, storeurl.pl, tunning.conf, dan refresh.conf nya? tolong kirim ke email ya mas…thank sebelumnya!
check this http://goo.gl/oJUwL
mas mau tanya nih
saya sudah berhasil install
dan di access log sudah bisa kelihatan access nya…
cuma kenapa video youtube belum ke cache ya>???
apa adas kesalahan???
thank’s