網頁

2013年12月1日 星期日

CentOS 6.x --- How to set Timezone, Date and Time

For AD authentication, we have to focus on Time synchronization between AD and client so that Timezone/Date/Time will be accurate on the related clients.

As to the standalone environment, it still is very important if we need to trace some logs for troubleshooting or analyzing the system and application. The only different operation is that we also have to correct it step by step manually.
How to do it? To login as root account and run the following step for this target.

Set System Timezone
To realize what zone want to be changed by executing the ls /usr/share/zoneinfo/Asia command next to add some content as ZONE=”Asia/Taipei” into the /etc/sysconfig/clock file for the proper timezone.ScreenShot002To reload the clock right now by using the source /etc/sysconfig/clock command and copy the right timezone file as Asia/Taipei under the /usr/share/zoneinfo directory to the /etc directory by using the cp –p /usr/share/zoneinfo/Asia /etc/localtime command.

Set Time and DateTo change manually the date and time by using the date - - set=”Sun Dec 1 13:37:00 CST 2013commandScreenShot001
Set Hardware Clock (RTC)
To set the current system time to the Hardware Clock by using the hwclock - -systohc command if we want to update the hardware clock.ScreenShot009So does that the accurate time will be kept after reboot.

2013年11月2日 星期六

JDK --- Install & Choose OpenJDK or Oracle JDK on CentOS x64

By default, the CentOS minimal installation doesn’t install any JDK as OpenJDK. If we need this component for executing Java program, how to install it?

Install OpenJDK and Use it by default
To confirm whether ever install the OpenJDK by using the rpm –qa | grep –E ‘^open[jre|jdk]|j[re|dk]’ or yum list installed | grep openjdk ,and realize whether exist a java symbolic link in the /etc/alternatives directory.ScreenShot004If ever install the OpenJDK, we can check what version locate on the RPM repository by using the yum list \*openjdk\* | grep openjdk command.ScreenShot001To install the Java Runtime Environment by using the yum install java-1.7.0-openjdk commandScreenShot005If we want to develop the Java program, we have to install the related package by using the yum install java-1.7.0-openjdk-devel commandScreenShot006To confirm the OpenJDK again by using the rpm –qa | grep –E ‘^open[jre|jdk]|j[re|dk]’ or yum list installed | grep openjdk ,we will found out the OpenJDK has already been installed and the java symbolic link exist in the /etc/alternatives directory.
ScreenShot001To find the location of the JAVA_HOME environment variable by using the update-alternatives --display java command. So does that we know the JAVA_HOME will be /usr/lib/jvm/jir-1.7.0-openjdk.x86_64ScreenShot003To remove # sign from the /etc/java/java.conf fileScreenShot004To set JDK environment variable in the /etc/profile file next to apply the setting by using the source /etc/profile commandScreenShot005To verify whether the path is right by using the echo $PATH and the java use OpenJDK version by using the java - - version are right.ScreenShot006To find the path of the Java executable file by using the which java command or the location of java link by using the whereis java command.ScreenShot002
Install Oracle JDK and Use it by default
If we want to use Oracle JDK, how to switch the JDK command from OpenJDK to Oracle JDK?
At first, we have to install Oracle JDK on the same platform (# 1) so that need to download this package from Oracle website.
Due to it fail to download the JDK package from Oracle by wget commandScreenHunter_05We still have to contact Oracle Java Archive for downloading it manually by clicking Java SE 6 link.ScreenHunter_01To select the right JDK version as Java SE Development Kit 6u45 ScreenHunter_02To choose Accept License Agreement optionScreenHunter_03To select the right file as jdk-6u45-linux-x64-rpm.bin because the JDK will install on CentOS x64 by RPM method.ScreenHunter_04To sign in by the registered Oracle account and password next to download this file if the authentication pass.ScreenHunter_05To set the executable permission to this binary file by using the chmod +x ./jdk-6u45-linux-x64-rpm.bin commandScreenHunter_06To extract the java archive file but not directly install it by using the ./jdk-6u45-linux-x64-rpm.bin –x commandScreenHunter_07To upgrade/Install JDK by using the rpm –Uvh jdk-6u45-linux-amd64.rpm command So does that by default Java will be installed to the /usr/java/jdk1.6.0_45 directory and it creates two links /usr/java/latest & /usr/java/defaultScreenShot003After the Oracle JDK package is installed,we need to configure each component as java by using the alternatives - - install /usr/bin/java java /usr/java/latest/jre/bin/java 20000 command and to tell the system that default java command has already switched to this by using the update-alternatives - - config java command.ScreenShot007To do the same step for javac by using the alternatives - - install /usr/bin/javac javac /usr/java/latest/bin/javac 20000 command and the update-alternatives - - config javac commandScreenShot009 To do the same step for javaws by using the alternatives - - install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000 command and the update-alternatives - - config javaws commandScreenShot008To do the same step for javaws by using the alternatives - - install /usr/bin/jar jar /usr/java/latest/bin/jar 20000 command and the update-alternatives - - config javaws commandScreenShot010To list the symbolic link in the /etc/alternatives directory by using the ls –lA /etc/alternatives/ command and realize that set the default command for Oracle JDK now. ScreenShot011To change JAVA_HOME environment variable from /usr/lib/jvm/java-1.7.0-openjdk.x86_64 to /usr/java/latest in the /etc/profile file next to apply the setting by using the source /etc/profile commandScreenShot012To verify whether the path is right by using the echo $PATH and the java use Oracle JDK version by using the java - - version command.ScreenShot014
Reference
:
(# 1).On 64 bit Linux platform, we have to install one 32 bit JDK or 64 bit JDK but cannot co-exist if install it by RPM.
If we have to install the different version on the same platform, it will be workaround method that one is by RPM and the other is by BIN to install into the distinct directory.

2013年10月16日 星期三

Samba 4.x --- Install (via yum) from SerNet Samba

Although it is very simple method to install Samba by yum command, the Samba version is not the newest version so that will include some risk as security or function.ScreenShot037Whether exist any repository with the Samba up to date?
It will be good option that install from SerNet Enterprise Samba package
ScreenShot001
Register the SerNet User Manager
When we go to this Web site, it clearly tell us that need to register and login to be able to download Samba package. To click register link so that will redirect to the registration portal
At first, we have to create an account so that click Sign up link
ScreenShot001In the account form, please write down some information as username, password … on asterisk field.ScreenShot002After clicking Sign up button, a message will tell us that a confirmation link will send to the registered email address.ScreenShot003When we get this mail from the Sernet registration portal, please click the link to confirm the account email.ScreenShot004It will log in the SerNet Website and tell us that we can download files if log on by using username/password in the future. Until now, we have already finished the registered procedure.ScreenShot005Due to we will use the yum command to download the repository file on CentOS 6, please click sernet-samba-4.0.repo(yum) link to realize what is the repository template file.ScreenShot007In the Confirm page, please click OK button if we log in this Website with the right username.ScreenShot008So does that we will see what the content of the repository template is.ScreenShot012In the moment, we will switch to the /etc/yum.repos.d repository path, create a repository file as serner-samba.repo, and add some words as the template content excluding USERNAME:ACCESSKEY is replaced with the personal username:accesskey.ScreenShot013
Add SerNet RPM Repository
Due to the related packages are signed with SerNet’s gpg build key to guarantee authenticity, we have to firstly install the build key on system by using the wget http://ftp.sernet.de/pub/sernet-build-key-1.1-3.noarch.rpm (# 1) and rpm -i sernet-build-key-1.1-3.noarch.rpm commandScreenShot011Or import the key manually as follows:
To get the SerNet’s key manually by using the gpg --keyserver wwwkeys.pgp.net --recv-keys F4428B1A commandScreenShot014To export the SerNet’s RPM public key into a file that can display it on a Web page or paste it in email by using the gpg --export --armor F4428B1A > /etc/pki/rpm-gpg/sernet-pubkey commandScreenShot003To import the SerNet’s RPM public key by using the rpm --import /etc/pki/rpm-gpg/sernet-pubkey commandScreenShot005
Install the Samba Packages
After finish the above key imported, we will begin to install Sernet Samba by using the yum install –enablerepo=sernet-samba sernet-samba commandScreenShot028ScreenShot029ScreenShot030ScreenShot031If the Samba will pay a Domain Controller role, we have to install the related package by using the yum install –enablerepo=sernet-samba sernet-samba-ad commandScreenShot034ScreenShot035Now we have already installed the last Samba version then.ScreenShot003
As to How to provision the Samba into AD DS?
Please refer to the pervious post 
Samba 4.x --- Install(via tar or git) configure and provision AD DS on CentOS 6.x

Reference :
(# 1) Please remember to install this packages before use the wget command.ScreenShot010
Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.