Tech Blog

These are blog entries written by the UNIX Health Check development team. Our team has extensive technical experience on both AIX and Red Hat systems, and we like to share our knowledge with our visitors.

Topics: Red Hat / Linux

When was a password changed?

This command will show you when a user's password was last changed, for example for user root:

# chage -l root

Topics: Installation, Red Hat / Linux

Extra's in Ubuntu

Even though Ubuntu is very complete initially, you might want extra's, like a media player. You can use a script to do this for you:

# wget http://download.ubuntuforums.org/ubuntusetup/ubuntusetup.sh
# sudo sh ubuntusetup.sh

Topics: Red Hat / Linux

Finding empty directories

A very easy command to find all empty directories on a system:

# find dir -empty -type d -depth -print
The "-empty" parameter doesn't work on AIX.

Topics: Installation, Red Hat / Linux

Yum

Use yum to update your system (for Fedora or Red Hat):

# yum update
will update all the packages on your system. If you need to configure a proxy server for yum to use, then just add the following line to /etc/yum.conf:
proxy=http://address-of-proxyserver.org:80
Of course set it to your correct proxy server and port number.

Topics: Red Hat / Linux

Auto-starting ssh

If you want to make sure SSH is auto-started at system reboot on Red Hat:

# chkconfig --list sshd
If you don't see the word "on" under the 3 and 5 columns then:
# chkconfig sshd on
# service sshd start

Topics: Red Hat / Linux

Installing VNC server

This is a description on how to install a VNC server on a Linux system, and how to access it from a Windows desktop.

First run on the Linux server:

# yum install vnc-server twm xterm
Edit file /etc/sysconfig/vncservers, and add:
VNCSERVERS="1:user1 2:user2 3:user3 4:user4 "
VNCSERVERARGS[1]="-geometry 1024x768"
VNCSERVERARGS[2]="-geometry 1024x768"
VNCSERVERARGS[3]="-geometry 1024x768"
VNCSERVERARGS[4]="-geometry 1024x768"
For your situation, make sure you enter valid user accounts for each user that you want to allow a VNC connection. In the example above, these are users user1, user2, user3 and user4. Also make sure that you create a VNCSERVERARGS entry for each user.

Create the users (if they don't exist already):
# useradd user1
# passwd user1
# su - user1
# vncpasswd
Repeat for the other users.

Add ports 5901, 5902, 5903 and 5904 to the firewall (tcp). This step depends on your Linux system.

Edit /home/user1/.vnc/xstartup:
#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
Copy this xstartup file to the home directory of the other users.

Restart the vncserver:
# service vncserver restart
Download & install TightVNC on your Windows desktop; you only need to install the Viewer.

http://www.tightvnc.com/download.html

Run TightVNC Viewer, and enter hostname:x (where "x" is the number of your display as defined in the vncservers file above, and where hostname is the hostname of the Linux server) as the VNC server, and click on Connect. Enter the corresponding password as set by the vncpasswd command and you should get a VNC window on your host.

Topics: Installation, Red Hat / Linux

Installing MySQL, PHP and Apache

Install the software:

# yum -y install mysql mysql-server php-mysql httpd php phpmyadmin
Create link from the DirectoryRoot of the webserver to PhpMyAdmin:
# cd /var/www/html
# ln -s /usr/share/phpMyAdmin
Make sure the services are started at boot time:
# chkconfig httpd on
# chkconfig --add mysqld
# chkconfig mysqld on
# service httpd start
# service mysqld start
Set the root password for mysql:
# mysqladmin -u root password root
Make additional security-related changes to mysql:
# mysql -u root -p
mysql> DROP DATABASE test; [removes the test database]
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous access]
Following the above steps, the document root for Apache is /var/www/html/. Create a test PHP script (such as phpinfo.php) and place it in the document root. A useful test script sample:
<?php
   phpinfo();
?>
Test with a brower: http://hostname/phpinfo.php

Create a database:
mysql> create database testdb
Add the following to /etc/httpd/conf/httpd.conf:
<Directory "/usr/share/phpMyAdmin">
   Order allow,deny
   Allow from all
</Directory>
Set the ServerName entry to hostname:80

Add "index.php" to the DirectoryIndex entry, so the webserver also recognizes index.php as an index file.

Restart the http server:
# service httpd restart
Test with a browser: http://hostname/phpMyAdmin/

Topics: Installation, Red Hat / Linux

Enable the FTP server

Run to install:

# yum install pure-ftpd
Have it start at system reboot:
# chkconfig pure-ftpd on
Start it:
# /etc/init.d/pure-ftpd start
Enable UnixAuthentication in /etc/pure-ftpd/pure-ftpd.conf.

Restart the FTP server:
# /etc/init.d/pure-ftpd restart

Topics: Installation, Red Hat / Linux

APT

APT is short for Advanced Packaging Tool and is found in Debian distributions of Linux, like Ubuntu. To be able to use APT, you first need to download a list of available software:

# sudo apt-get update
To download the webbrowser Firefox, type:
# sudo apt-get install mozilla-firefox
With the command
# sudo apt-cache search [search-term]
you can search for a specific program.
To upgrade your complete system:
# sudo apt-get upgrade
Besides the command-line, you can also use the graphical user interface Synaptic.

Topics: Red Hat / Linux, Storage, VMWare

Increasing the VMWare disk drive

If you have any VMWare images, where you made the disk size a little too small, then fortunately in VMWare Workstation you can change the size of a disk with a simple command line program. Sadly the command only makes your drive bigger not the actual partition. And especially Windows won't allow you to resize the partition where the Windows binaries are installed. So how can you get around that?

First, create a copy of your vmdk file to somewhere else, should the next action fail for some reason.

Then resize the disk to the required size:

# vmware-vdiskmanager -x 8GB myDisk.vmdk
You need to have plenty of disk space free to do this operation, as your vmdk file will be copied by vmware-vdiskmanager. BTW, this command may take a while, depending on the size of your vmdk file.

Now get the ISO image of System Rescue CD-ROM and set the VMWare session to boot of the ISO image. Then, run QTParted. You can do this by starting this CD-ROM with a framebuffer (press F2 at start) and then run run_qtparted as soon as Linux has started. Select the windows drive partition with the right mouse button and choose resize. Set the new size and commit the change. Then exit from QTParted and from Linux (init 0). Remove the ISO image from the VMWare session and restart VMWare to normally start Windows. Windows will detect the disk change and force a chk_disk to run. Once Windows has started, the new disk size is present.

Number of results found for topic Red Hat / Linux: 103.
Displaying results: 91 - 100.