Ubuntu Server Tips

Check remaining disk space

df -h
Reports free space on each mount.

Monitor web server in real time

tail -f /var/www/yoursite/logs/access.log
Reads Apache access long file and displays changes in real time. Your log file may be in different location depending on settings.

Check Ubuntu Server Linux version

Ubuntu Server doesn't have GUI, but you can find version using number of terminal commands

lsb_release -a

cat /etc/issue

cat /proc/version

uname -a

Set up Linux (Ubuntu) server to synchronise clock with NTP time server

ntupdate

ntupdate comes built in into Ubintu server. To manually adjust server time run:
sudo ntpdate ntp.ubuntu.com
You can choose another ntp server instead of  ntp.ubuntu.com

ntpd

To automatically keep server time up to date use ntp.

Install ntpd:
sudo apt-get install ntp

ntpd should start working immediately without any additional configuration. However you obviously can adjust settings if you wish.

Configuration

ntpd configuration file is located in /etc/ntp.conf

Default server is server ntp.ubuntu.com
To use additional servers just add them bellow server ntp.ubuntu.com. e.g.
# You do need to talk to an NTP server or two (or three).
server ntp.ubuntu.com
server pool.ntp.org


To enable logging uncomment:
statsdir /var/log/ntpstats/
logs will be placed in /var/log/ntpstats/

Useful commands

Reastart ntp
sudo /etc/init.d/ntp restart
Stop ntp
sudo /etc/init.d/ntp stop
Start ntp
sudo /etc/init.d/ntp start

List peers and status
ntpq -p

Check in ntpd process is running
ps ax | grep ntp

Ubuntu Server 10.10


Disable directory listing (index) in Apache


/etc/apache2/httpd.conf
Add line
Options –Indexes
sudo /etc/init.d/apache2 reload

OR

/etc/apache2/sites-availabl/[sitename]
find line:
Options Indexes FollowSymLinks MultiViews
And add "-" in front of the "Indexes":
Options -Indexes FollowSymLinks MultiViews
sudo /etc/init.d/apache2 reload

Ubuntu Server





Newsletter

Subscribe to receive occasional updates on new posts.
Your email will not be used for any other purpose and you can unsubscribe at any time.
Please wait
Privacy Policy