
FreeBSD Useradd
To add a user called tom, enter:
# pw useradd -n tom -s /bin/csh -m# passwd tom
Where,
- -n tom : Username
- -s /bin/csh : Set shell
- -m : Create and setup home directory /home/tom
- -d : to provide a custom home directory
To Delete a user called tom
Enter the command:
#pw userdel -n tom -r
FreeBSD Port Installation
FreeBSD operating systems offers Ports Collection as a simple way to install various applications. Each port contains any patches necessary to make the original application source code compile and run on FreeBSD.
Before using ports, you must first obtain the Ports Collection /usr/ports directory. The portsnap command allows you to install ports collection over the Internet. To grab collection, enter:
You can also use the Ports Collection's built-in search mechanism. To use the search feature, you will need to be in the /usr/ports directory. Once in that directory, run make search name=program-name where program-name is the name of the program you want to find. For example, if you were looking for apache, enter:
Installing BASH on FreeBSD
Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. csh / tcsh (C shell with file name completion and command line editing) is the default shell under FreeBSD. However, you can easily install and use bash as shell.
To Install bash under FreeBSD, Login as root and type the following commands to install bash using FreeBSD ports:
# portsnap update extract
# cd /usr/ports/shells/bash
# make install clean
To install FreeBSD binary package, enter:
# pkg_add -r bash
How do I use bash under FreeBSD?
To use bash shell, enter:
# bash
OR
# /usr/local/bin/bash
How do I set bash as a default shell?
To set bash as default, shell enter:
# chsh -s /usr/local/bin/bash {username}
# chsh -s /usr/local/bin/bash vivek
# chsh -s bash
Verify that bash is default shell for a user account called vivek, enter:
grep vivek /etc/passwd
OR
egrep --color 'vivek|zsh' /etc/passwd
OR
finger vivek
Sample outputs:
Login: vivek Name: Vivek Gite
Directory: /home/vivek Shell: /usr/local/bin/bash
On since Tue May 8 02:15 (IST) on pts/0 from 192.168.1.5
No Mail.
No Plan.
Ref:
http://www.cyberciti.biz/faq/freebsd-bash-installation/
================================================================================================
FreeBSD Port Installation
FreeBSD operating systems offers Ports Collection as a simple way to install various applications. Each port contains any patches necessary to make the original application source code compile and run on FreeBSD.
Before using ports, you must first obtain the Ports Collection /usr/ports directory. The portsnap command allows you to install ports collection over the Internet. To grab collection, enter:
# portsnap fetch
To extract the snapshot into /usr/ports, enter:
# portsnap extract
Type the above command for the first time only. If you already have a
populated /usr/ports and you are just updating, run the following
command instead:
# portsnap update
"Installing packages through port"
Before you can install any Ports you need to know what you want, and
what the application is called. If you know the exact name of the port,
you can use the whereis command as follows:
# whereis apache22
# whereis php5
# whereis lsof
You can also use the Ports Collection's built-in search mechanism. To use the search feature, you will need to be in the /usr/ports directory. Once in that directory, run make search name=program-name where program-name is the name of the program you want to find. For example, if you were looking for apache, enter:
# cd /usr/ports
# make search name=apache
The following will perform searches for port names, comments,
descriptions and dependencies and can be used to find ports which relate
to a particular subject if you do not know the name of the program you
are looking for.
# cd /usr/ports
# make search key=string
# make search key=php5
To install the Apache22 port, enter:
# cd /usr/ports/www/apache22/
# make install clean
================================================================================================
Installing BASH on FreeBSD
Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. csh / tcsh (C shell with file name completion and command line editing) is the default shell under FreeBSD. However, you can easily install and use bash as shell.
To Install bash under FreeBSD, Login as root and type the following commands to install bash using FreeBSD ports:
# portsnap update extract
# cd /usr/ports/shells/bash
# make install clean
To install FreeBSD binary package, enter:
# pkg_add -r bash
How do I use bash under FreeBSD?
To use bash shell, enter:
# bash
OR
# /usr/local/bin/bash
How do I set bash as a default shell?
To set bash as default, shell enter:
# chsh -s /usr/local/bin/bash {username}
# chsh -s /usr/local/bin/bash vivek
# chsh -s bash
Verify that bash is default shell for a user account called vivek, enter:
grep vivek /etc/passwd
OR
egrep --color 'vivek|zsh' /etc/passwd
OR
finger vivek
Sample outputs:
Login: vivek Name: Vivek Gite
Directory: /home/vivek Shell: /usr/local/bin/bash
On since Tue May 8 02:15 (IST) on pts/0 from 192.168.1.5
No Mail.
No Plan.
Ref:
http://www.cyberciti.biz/faq/freebsd-bash-installation/
================================================================================================
HowTo Change IP Address / Setup New IP Address For Existing Interface on FreeBSD
To display the current configuration for the network interfaces on your FreeBSD server, type the following command:
# ifconfig
You need to use the ifconfig command as follows to assign an IP address:
# ifconfig interfaceName inet IPAddress
To assign an ip to lnc0 interface, enter:
# ifconfig lnc0 inet 202.54.1.22
Please note that lnc0 is an ethernet interface name. It can be Obtained by tying the following command:
# ifconfig -a
To setup up ip address permanently open a file called /etc/rc.conf and append/modify network entries as follows:
# vi /etc/rc.conf
hostname="fbsdx.test.com"
ifconfig_lnc0="inet 192.168.0.6 netmask 255.255.255.0"
### Default gateway ###
defaultrouter="192.168.0.254"
Save and close the file. Please note that ifconfig_lnc0 is Ethernet interface name. It can be Obtained using ifconfig -a command.
You can restart networking service using the following command:
# /etc/rc.d/netif restart && /etc/rc.d/routing restart
================================================================================================
No comments:
Post a Comment