Safe, High performance, reuseable

Monday, December 10, 2012

Fedora 17 Linux Knowledge

1. Login GUI as Supperuser 

Open your Terminal from Applications -> System Tools -> Terminal
Step 1 :- Now Login as a root from your terminal
[fedora17@xxx]$ su
 Password:-

Step 2:- Now go to your /etc/pam.d/ directory.
[root@xxx]# cd /etc/pam.d/
Then first take a backup of gdm file
cp gdm-password gdm-password.bkp ( always take backup if anything goes wrong you can correct it by original file)

Step 3 :- Now Open gdm file in your favourite editor. I am using vi as my editor.
[root@ tejas-barot-ahmedabad-linux pam.d]# vi gdm-password

Find line auth required pam_succeed_if.so user != root quiet
And change it to ## auth required pam_succeed_if.so user != root quiet

Step 4 :- Save & Exit From that File.
Step 6 :- Save & Exit from File. Now Logout and Try to Login as a root user. Now you are able to Login as a root user from GUI in Fedora 17.

2. Add script to start up


Your script should be in /etc/init.d/ directory.
Then you have to make a symlink from your run-level directory.
I.e you're in run-level 5 (multiuser with X)

Code:
cp   /etc/init.d
ln -s /etc/init.d/[script file name] /etc/rc.d/rc5.d/S50[script file name]
ln -s /etc/init.d/[script file name] /etc/rc.d/rc5.d/K50[script file name]
The S50 is to tell the system to start the script when it boots up,
the K50 is to tell the system to shut down cleanly when you do a shut down.
The number representates in which order the script should start/shut down in. This way you have the possibility to explicity start your server after like when you started networking and other servers that is required by your server.

Change my example obove with your scriptfile name.
Ah, and remember to do "chmod +x


3. Fedora 17 install JDK

1. Download Sun/Oracle Java JDK/JRE 7u9 32-bit/64-bit RPM packages
Download Sun/Oracle Java 7u9 from here http://www.oracle.com/technetwork/java/javase/downloads/index.html. Select rpm package (jdk-7u9-linux-i586.rpm, jdk-7u9-linux-x64.rpm, jre-7u9-linux-i586.rpm or jre-7u9-linux-x64.rpm).


2. Change to root user.

sudo -i
## OR ##
su -

3. Install Java JDK or JRE package

## JDK 32-bit ##
rpm -Uvh /path/to/binary/jdk-7u9-linux-i586.rpm

## JDK 64-bit ##
rpm -Uvh /path/to/binary/jdk-7u9-linux-x64.rpm

## JRE 32-bit ##
rpm -Uvh /path/to/binary/jre-7u9-linux-i586.rpm

## JRE 64-bit ##
rpm -Uvh /path/to/binary/jre-7u9-linux-x64.rpm

4a. Install Sun/Oracle JDK java, javaws, libjavaplugin.so (for Firefox/Mozilla) and javac with alternatives –install command
Use Java JDK latest version (/usr/java/latest)

## java ##
alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000

## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 20000

## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 20000

## Install javac only if you installed JDK (Java Development Kit) package ##
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 20000

## java ##
alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_09/jre/bin/java 20000
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0_09/jre/bin/javaws 20000


## export JAVA_HOME JDK ##
export JAVA_HOME="/usr/java/jdk1.7.0_09"

4. Setup "sudo"

* Modifying sudoers file

Normally if you want to run a command which requires root privileges you first have to type 'su -', type your root password and then type the command. However you can bypass this by using the 'sudo' command. But first you have to configure it like this

su --login -c 'visudo'

Now go below the line:

root    ALL=(ALL)       ALL

press a, and type the following

username ALL=(ALL)      ALL

where username is the username you use to login. Next press Escape. Now, if you want to be prompted for your root password each time you use the sudo command go to this line:

# %wheel        ALL=(ALL)       ALL

and with your cursor pointing on # press x If you don't want to be prompted for your root password each time you use the sudo command go to this line:

# %wheel        ALL=(ALL)       NOPASSWD: ALL

and with your cursor pointing on # press x Next, press :wq to save and exit. (type the : as well) * Adding your user to the wheel groupJust type: su -c 'gpasswd -a username wheel'

* Testing sudo

To test if you have done it correctly as a simple user type:

$ sudo whoami

If everything is working properly the command should return the word 'root'.

 

No comments: