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.
[email protected]:~ # ls -l /usr/ports ls: /usr/ports: No such file or directory [email protected]:~ #
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
[email protected]:~ # whereis nginx nginx: /usr/ports/www/nginx [email protected]:~ #
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
[email protected]:~ # service nginx start Cannot 'start' nginx. Set nginx_enable to YES in /etc/rc.conf or use 'onestart' instead of 'start'. [email protected]:~ #
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
[email protected]:~ # 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. [email protected]:~ #
Find PHP available in ports
cd /usr/ports make quicksearch name=php