This is Part 2 of Post FreeBSD – A revisit after 10 years
FreeBSD ports allow you to install software from source.
Ports tree is stored in folder /usr/ports.
On this server /usr/ports folder does not exists.
root@boby:~ # ls -l /usr/ports ls: /usr/ports: No such file or directory root@boby:~ #
We need to fetch ports tree with command
portsnap fetch extract
Update ports tree
portsnap fetch update
Searching for a software
To find a software in ports tree, use command whereis
root@boby:~ # whereis nginx nginx: /usr/ports/www/nginx root@boby:~ #
Installing software
We found nginx software available in ports tree at /usr/ports/www/nginx, lets install it.
cd /usr/ports/www/nginx make make install
Now you get this nice nginx configuration UI to select modules you need.
Starting nginx
root@boby:~ # service nginx start Cannot 'start' nginx. Set nginx_enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'. root@boby:~ #
That failed with message asking us to add nginx_enable=YES in /etc/rc.conf
echo "nginx_enable=YES" >> /etc/rc.conf
Now you will be able to start nginx
root@boby:~ # service nginx start Performing sanity check on nginx configuration: nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful Starting nginx. root@boby:~ #
Find PHP available in ports
cd /usr/ports make quicksearch name=php