How to install or add a package in FreeBSD
To install a Port: (ImageMagick as an example)
cd /usr/ports/graphics/ImageMagick/ && make install clean
If you do not have a source of local packages (such as a FreeBSD CD-ROM set) then it will probably be easier to use the -r option to pkg_add(1). This will cause the utility to automatically determine the correct object format and release and then fetch and install the package from an FTP site.
The example above would download the correct package and add it without any further user intervention.
pkg_info(1) is a utility that lists and describes the various packages installed.
To remove a previously installed software package, use the pkg_delete(1) utility.
FreeBSD Installation notes for DirectAdmin
If logging in as a user other than admin or root (using su to gain root access)
You have to add “AllowUsers username” to /etc/ssh/sshd_config before you can log out from root or you’ll lose root on the server forever, and you’ll have to format.
Hint: Use “fetch” instead of “wget” on FreeBSD systems to download the install file.
Installing Usermin in FreeBSD
Usermin is a web-based interface for webmail, password changing, mail filters, fetchmail and much more. It is designed for use by regular non-root users on a Unix system, and limits them to tasks that they would be able to perform if logged in via SSH or at the console.
SSH to your server and su to root.
Use the cd command to change to the port directory for Usermin:
# cd /ports/sysutils/usermin
Run the following command to install Usermin:
During the install process, you will be prompted for various information.
Use the defaults (hit Enter when prompted) for the Config File directory, Log file directory, Full path to Perl, and Web server port.
Select NO when asked if you want to use SSL. Once Usermin is installed and running, you will have the option to configure SSL support from the Webmin control panel.
It may take several minutes (depending on server load) for Usermin to finish the installation. Once the installation has completed, you will need to start Usermin using the following command:
# /usr/local/etc/usermin/start
Adding user/group in a FreeBSD server
How do I add a user and group to the FreeBSD Server?:
The ‘pw’ command can be used to add a user and or group to the FreeBSD System. The ‘pw’ command is a program that will allow any user with superuser privileges to edit and or add users and groups on FreeBSD with ease. It also allows a way to standardize modification of adding and removing users and groups.
This would create the group ‘anewgroup’ to the machine.
Now to add a users ‘ben’ to the ‘anewgroup’ using pw, issue the following command.
pw useradd ben -s /bin/csh -g anewgroup
This command would create the user ben, with a shell of /bin/csh and add it to the anewgroup group. The user would also have his home directory under /home/ben.
Now say, if the user needs to have the home directory on a different partition, for example /mnt/test/home issue the following command.
pw useradd ben -d /mnt/test/home/ben -s /bin/csh/ -g anewgroup
If the user ‘ben’ is to be added to a secondary group on the system, say a group that has been created already called ‘oldgroup’, then execute the following.
pw usermod ben -G oldgroup
Steps to upgrade MySQL in FreeBSD
Steps to upgrade MySQL version 4 to 5 in the FreeBSD :
1. Backup the existing MySQL database.
$ cd /var/db/
$ tar cvfz mysql.tar.gz mysql
2. Stop the MySQL service.
$ /usr/local/etc/rc.d/mysql-server.sh stop
3.Remove the existing MySQL Server .
pkg_delete mysql-server-4.*.*
pkg_delete mysql-client-4.*.*
Replace the ‘*’ with the version that is the server.
4. For installing the new MySQL Server, execute the following step.
$ cd /usr/ports/databases/mysql50-server && make install clean
5.Start MySQL 5.0 in the server and run the upgrade script.
$ /usr/local/etc/rc.d/mysql-server.sh start
$ /usr/local/bin/mysql_upgrade -u root -p –datadir=/var/db/mysql
You will be prompted for the new MySQL password where you can provide it.