HostOnNet Blog

FreeBSD – A revisit after 10 years (part 2)

Looking for Linux Server Admin or WordPress Expert? We can help.

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.

1
2
3
root@boby:~ # ls -l /usr/ports
ls: /usr/ports: No such file or directory
root@boby:~ #

We need to fetch ports tree with command

1
portsnap fetch extract

Update ports tree

1
portsnap fetch update

Searching for a software

To find a software in ports tree, use command whereis

1
2
3
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.

1
2
3
cd /usr/ports/www/nginx
make
make install

Now you get this nice nginx configuration UI to select modules you need.

Starting nginx

1
2
3
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

1
echo "nginx_enable=YES" >> /etc/rc.conf

Now you will be able to start nginx

1
2
3
4
5
6
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

1
2
cd /usr/ports
make quicksearch name=php

Posted in FreeBSD

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.