Monday, 8 September 2008

sudo and pkg_add working together

Installing software into FreeBSD could be done 2 ways. The nice way using ports and the fast way using packages. The mechanism to install packages is using pkg_add. As installing software requires root privileges sudo should be the way to go for it.

But while using sudo to call pkg_add gives you an error:

[rick@davis /usr/home/rick]$ sudo pkg_add -r mysql51-serverError: FTP Unable to get Syntax error, command unrecognized
pkg_add: unable to fetch '' by URL

This problem is caused by the lack of a few environment variables which get lost while calling it trough sudo, as mentioned in this mailing list post to freebsd-ports

They way to solve it is to call sudo with argument -E which gives you they required result :-)

[rick@davis /usr/home/rick]$ sudo -E pkg_add -r
Fetching Done.
Fetching Done.
Added group "mysql".
Added user "mysql".

No comments:

Post a Comment