We have interesting hostname for our all our servers. Some of it is using Football Team like Manchester, Liverpool, Chelsea, Arsenal. Part of it is striker name like Rooney, Ronaldo and etc. We also have like meganfox, milla, jessicaalba for those “hot” “steamy” servers. Occasionally if the football team is not perform well, we will change the hostname for the server to other football team, for example Manchester to Chelsea. Yea.. We are not loyal support, we only support the no. 1 team.
Joking aside, how to change server hostname in Unix FreeBSD? There are 2 ways to do it, one is the easy way another is the geeky way. Depend on yourself, if you want to show your elite skills, do it with the text editor, or make the change with Sysinstall.
Change Hostname in Unix FreeBSD with Sysinstall
- In command line, type: sysinstall
- Select Configure
- Select Networking
- Select Interfaces
- Select your Network Interface Card (em0 em1 fxp0)
- No IPV6 (Select yes if you are running on ipv6)
- No DHCP (Select yes if you are running on dhcp)
- host: should be your server name like chelsea
- domain: should be your own domain like takizo.com
- Select Ok
- Exit, Exit, Exit
- In command shell, type: hostname chelsea.takizo.com
This will update your new hostname in Unix FreeBSD box. But please take note you will have extra junk in /etc/rc.conf. So it’s recommend to change your hostname in Unix FreeBSD with following method.
Change Hostname in Unix FreeBSD in “Clean” Way
- In command shell, type: hostname chelsea.takizo.com
- Edit /etc/hosts with vi, change the existing hostname to your new hostname
- Edit /etc/rc.conf with vi, on the “hostname” variable change the existing hostname to your new hostname
This is the better approach in order to organize your /etc/rc.conf clean and clear.
takizo posted on June 3rd, 2010 in Systems category | Tags: freebsd, hostname, server, unix
Nobody dare to comment yet »
In FreeBSD, user’s default shell environment is either sh or csh and I have installed Bash in FreeBSD and would like to change user’s shell environment to Bash.
To change user’s shell environment in FreeBSD.
shell> chsh -s /usr/local/bin/bash userid
To change your shell environment in FreeBSD
shell> chsh -s /usr/local/bin/bash
takizo posted on May 26th, 2010 in Systems category | Tags: bash, csh, freebsd, sh, shell, unix
Nobody dare to comment yet »
By default, some of the application installation provide you a sample configuration file. Usually the sample of configuration will end with name like *.sample, *.default and so on. Let say you have 20 of *.sample files and it will take you some time to copy, move or rename one by one. Lets do some quicker way which will save more time.
Create a sample file file random name ended with *.sample. Example
touch apple.sample.cfg
touch microsoft.sample.cfg
touch php.sample.cfg
touch config.sample.cfg
touch apache.sample.cfg
touch mysql.sample.cfg
touch pgsql.sample.cfg
touch cacti.sample.cfg
touch wordpress.sample.cfg
touch jessicaalba.sample.cfg
Now you have all the sample configuration, you are going to use them. Are you going to copy one by another and change the same with .cfg prefix? We can do it, in a better and faster way.
Make a new directory to store all the sample file
mkdir sample
cp *.sample.cfg sample/
After that, go to sample directory and copy the files to a location
cd sample
for d in `ls *.sample.cfg`; do cp $d `echo $d | sed s/sample.cfg/cfg`; done
That one simple line will easily save you 1-2 minutes.
takizo posted on May 18th, 2010 in Systems category | Tags: copy, linux, linux command, sed, unix, unix command
3 Comments »
I believe most system admin does remote access to the server. Who doesn’t enable SSHD on FreeBSD? Almost every new FreeBSD installation, the first thing I will do after installation is enable SSHD Service on FreeBSD. Start the service and remote access from laptop, with a cup of coffee!
To enable SSHD on FreeBSD
- Edit the file: vi /etc/rc.conf
- Add: sshd_enable=”YES”
- To start sshd service: /etc/rc.d/sshd start
If it’s the first time you enable SSHD, it will generate the keys for the first time.
takizo posted on May 18th, 2010 in Systems category | Tags: freebsd, remote access, serivces, ssh, unix
Nobody dare to comment yet »
Disabled Sendmail Service on FreeBSD is slightly different compare to Linux. We usually disabled Sendmail Service and configure exim on FreeBSD. Sendmail service can be disabled via /etc/rc.conf.
Put these lines into /etc/rc.conf
sendmail_enable="NONE"
After that restart sendmail service
/etc/rc.d/sendmail restart
If you would like sendmail to be able to host outgoing email. Put these lines in /etc/rc.conf
sendmail_enable="NO"
After that restart sendmail service
/etc/rc.d/sendmail restart
takizo posted on May 14th, 2010 in Systems category | Tags: email, freebsd, sendmail, server
Nobody dare to comment yet »