This tutorial will guide you through the entire process of setting up a highly available NFS server. To proceed, you must have the following:
1. 2 servers with similar hard disk setup (These will be used to create a redundant nfs server)
2. atleast 1 server where the nfs share will be mounted.
3. Static IPs
4. Basic knowledge of vi (:q! = quit, :wq = write and then quit, i = insert mode, esc = leave insert mode, dd = delete line when not in insert mode)
First off, install CentOS on both machines. During the install process, create a separate blank partition on both machines to be used as your nfs mount. Set the mount point to /data during installation.
From this point on i’m going to be referring to both nfs servers by their IPs and hostnames. Server1 will be nfs1 with ip 10.132.196.221 and server2 will be nfs2 with ip 10.132.196.222. Your private IPs might be different so make sure to put in the correct IPs where necessary within this tutorial.
Couple days ago, I ran into this error on CentOS 5.2. To my understanding this error can occur on all flavors of linux.
This totally caught me by surprise as I had never seen this before. I had just finished installing awstats and wanted to run an update for the first time. The logs were gathered from 6 webservers and each webserver had about 225 logs.
The awstats log merging script tried to open these log files (225×6 = 1,350 logs) and merge them to read the data but it kept crashing. The reason it kept crashing was because the limit for the maximum number of files that you are allowed to open in a shell was set to 1024.
To check what your limits are just type in the following command:
ulimit -a
To change the limit for the number of files you are allowed to open, change the “open files” limit. To do so, type in the following command:
ulimit -n3000
This will set the limit to 3000 files. You can set it to whatever number you need to.
After changing my “open files” limit, I was able to run my initial awstats update without any issues.
Follow the steps below if you have forgotten your mysql root password and wish to reset it.
1. Create a text file with the following information in it.
UPDATE mysql.user SET Password=PASSWORD(’NEW_PASSWORD’) WHERE User=’root’;
FLUSH PRIVILEGES;
Replace “NEW_PASSWORD” with your desired mysql password. Save the file to /etc/mysql-pass-reset
2. Stop MySQL
/etc/init.d/mysqld stop
3. Start mysqld_safe with the –init-file option like so:
mysqld_safe –init-file=/etc/mysql-pass-reset &
This will start mysql and execute the query in the text file you created.
4. Now stop and start mysql back up normally without the –init-file option.
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
Don’t forget to delete the “mysql-pass-reset” file when you are done!
rm /etc/mysql-pass-reset
Here are the quick an easy steps on how to install TOS in Linux (Debian Distro).
First you will need to setup Java on your computer so lets go ahead and do that. Open up the console and login as super user.
su
Now that we have full privileges, lets edit the sources.list file so that we can fetch the much needed java packages.
pico /etc/apt/sources.list
This will bring up your sources.list file in the editor. You should see something that looks like this:
deb http://debian.lcs.mit.edu/debian etch main
deb-src http://debian.lcs.mit.edu/debian etch main
Add the words “contrib non-free” at the end of both lines so it looks like the following:
deb http://debian.lcs.mit.edu/debian etch main contrib non-free
deb-src http://debian.lcs.mit.edu/debian etch main contrib non-free
Now hit “Ctrl + O” to write the changes to the file. Then hit enter to accept the changes. Now hit “Ctrl + X” to exit the editor. That was the hard part
. Lets update our package listing and download the java packages by running the following commands:
apt-get update
apt-get install sun-java5-jre sun-java5-jdk
Follow the onscreeen instructions to complete the installation of the java packages. Its pretty much gonna ask you to agree to the licenses. After you are done you can close the console window.
File permissions in Linux are actually pretty easy to understand and modify. To check the permissions on a file just navigate to the directory and use the following command to list the files and their details.
ls -l
As you can see, the first piece of information on each line are the permissions. There are 3 sets of permissions put together all into one line. The very first character denotes whether the file is a directory, a link or a file.
- = file
l = symbolic link
d = directory
The 3 characters following the first character represent the permission information for the file owner. The 3 characters following that denote the permissions for the group and the last 3 characters are the file permissions for everyone else. A key for what the characters mean is listed below:
- = no read, write, or execute permissions
r = read
w = write
x = execute
For example, lets say we have the following permission information on a file.
drwxr-xr-x
Since the first character is “d” we know that its a directory. Then next 3 characters are “rwx” which means that the owner has read, write, and execute permissions. The next set of characters are “r-x” which means the group has read and execute permissions but no write permissions. The last 3 characters are “r-x” which means that everyone else has read and execute permissions but no write permissions.
You can easily change file permissions by using the “chmod” command. Using numbers to change permissions on a file is very quick, easy, and precise. A key for what each number represents is listed below.
4 = read
2 = write
1 = execute
You have to set permissions for the owner, group, and everyone else all at the same time when using the number method so that means there will be 3 numbers. The first number is the permission for the owner, the second is for the permission of the group and the last number is the file permission for everyone else.
To give the owner, group, and everyone else only read permissions then the command would be the following.
chmod 444 filename
To give the owner, group, and everyone else read and execute permission then you just add the numbers together. So 4(read) + 1(execute) = 5.
chmod 555 filename
The numbers don’t have to be the same, you can give different permissions to the owner, group and everyone else all in one shot. So lets say you want the file owner to have read, write and execute permissions but you want the group and everyone else to have only read and execute permissions. The command to do this would be the following.
chmod 755 filename
If you are applying permissions to a folder and would like to recursively change the permissions of the contents as well then don’t forget to use the capital ‘R’ switch:
chmod -R 755 somedir
Remember, the first digit is for the owner, the second digit is for the group and the last digit is for everyone else.