Showing posts with label How to. Show all posts
Showing posts with label How to. Show all posts

Tuesday, April 16, 2013

How to configure NTP Server and Client on CentOS

Introduction

NTP is widely used to synchronize a computer to Internet time servers or other sources, such as a radio or satellite receiver or telephone modem service. It can also be used as a server for dependent clients. It provides accuracies typically less than a millisecond on LANs and up to a few milliseconds on WANs. Typical NTP configurations utilize multiple redundant servers and diverse network paths in order to achieve high accuracy and reliability.

Configure NTP Server

  1. yum install ntp (and type 'y' when show up two questions);
  2. vi /etc/ntp.conf
  3. Add the next statement for accept requests from another servers (DNS server, LDAP server, etc.) on your LAN:
    restrict 10.50.0.0 mask 255.255.255.0 nomodify nopeer noquery
  4. Add the next statement for public servers NTP synchronize with server's internal clock on your LAN:
    server 0.europe.pool.ntp.org
    server 1.europe.pool.ntp.org
    server 2.europe.pool.ntp.org
    server 3.europe.pool.ntp.org
  5. This command allow to set current time from indicated NTP server:
    ntpdate pool.ntp.org
  6. The same server can be defined on configuration file:
    vi /etc/ntp/step-tickers
    pool.ntp.org
  7. service ntpd start
  8. Make sure the ntpd is active from beginning Linux boot;
    chkconfig ntpd on
  9. Checking synchronization status of service NTP.
    nptq -pn
    tail -f /var/log/messages

Configure NTP Client

  1. This file allows to set server NTP to use for initial adjust clock during starting of ntpd:
    vi /etc/ntp/step-tickers
    10.50.0.254
  2. On the file /etc/ntp.conf, all you need is add server NTP's IP address to use:
    vi /etc/ntp.conf
    server 10.50.0.254
  3. Checking synchronization status of service NTP.
    nptq -pn
    tail -f /var/log/messages
    It can take long to see message of success. When I was configuring, it took about 1 hour.

Conclusion

This protocol allows to keep operating system's clock synchronized with high accurate, running at information of synchronism got from another NTP servers.

Although the configuration is relatively simple, NTP performances a very important role. The possibility to make sure that clocks from many servers are kept with right time is relevant and it is a important factor to correct of many applications. The correction of local time in operating system allows also ensure that logs recorded in operating system have correct time and that is important when I use logs to diagnostic problems of some services.

Sharing folders without login - Samba

Samba is an open source software that allows to solve communications problems between Windows and Linux. With Samba, you can share folders, printers for Windows clients and can perform as a Primary Domain Controller (PDC) or as domain member. Samba can also be part of an Active Directory (AD) domain.

As a Systems Administrator, one of first things I wanted to do was share folders on Debian with my Windows to transfer easily files. My Debian is a local Web Server to test my PHP5 applications (yes, I am also PHP5 developer). Why do I want share folders without password? Because it is painful every time I need to login and I am working at home where is no danger around me. No one can crack me at home. At home, it is a great way to share files without login.

    How to install and configure samba
  1. su -
  2. insert your root's password
  3. mkdir /home/yourusername/mysharedfolder
  4. chown nobody /home/yourusername/mysharedfolder
  5. apt-get install samba
  6. nano /etc/samba/smb.conf
  7. security = share
  8. guest account = nobody
  9. [mysharedfolder]
    writable = yes
    path = /path/to/directory
    public = yes
    guest ok = yes
    guest only = yes
    guest account = nobody
    browsable = yes
    
  10. Ctrl+X and then y
  11. service samba restart

Optionally, you can use Samba Web Administration Tool (SWAT) to configure the settings of shared folder.

    How to install SWAT
  1. apt-get install swat
  2. Go to your favorite web browser and type the next URL: http://localhost:901
  3. insert your root login
  4. watch the next video how to configure samba

Samba is very useful tool for who want share files between Windows and Linux and SWAT is also very useful for who want configure settings of sharing easily.

I have created another article about Samba before but this one requires a login. If you want to do login, please read this article.

Wednesday, November 7, 2012

How to check Ubuntu version using command line

I wanted to see what was my Ubuntu version using command line. After I found this website, I could to see my Ubuntu version.

To check your Ubuntu version using command line:
  1. Open terminal (CTRL+ALT+T)
  2. Type lsb_release -a and press Enter
  3. The Ubuntu version will displayed on the screen

At the time, my Ubuntu version is Ubuntu 11.10 (oneiric).

Wednesday, October 17, 2012

How to change timezone on Apache Webserver

My Apache Webserver had not timezone correct. If I wanted timezone correct, I had to do some configuration on Apache Webserver. But how to do this?

To change timezone on my Apache Webserver, I followed the next steps:
  1. Type sudo nano /etc/php5/apache2/php.ini;
  2. Search for "date.timezone" and modify to "date.timezone="Europe/London" or to your timezone;
  3. Save the file and exit using CTRL+X;
  4. Type sudo /etc/init.d/apache2 restart

To see what is your timezone, check this website

At the moment, my operating system was Ubuntu 11.10 and Apache Webserver was 2.2.20!

Monday, July 9, 2012

How to import a MySQL dump file into a Database

To import MySQL dump file into a database you must have a MySQL command line shell.

Step #1: Make sure your database is already created. If database is not created yet, then you have to create one database. For example:

->mysql -h localhost -u root -p;
(enter your password)
->CREATE SCHEMA IF NOT EXISTS 'database_name';
->exit;

Note

You can replace "localhost" by an IP address (e.g. 192.168.1.88).

Step #2: Type the next command to import MySQL dump file into a database.

->mysql -h localhost -u root -p database_name < file.sql
(enter your password)

Voilá! Now you have a database with all data filled.

Tuesday, May 1, 2012

How to install Oracle Database Express Edition


I heard talk about technology Oracle PL/SQL but I never tried it. To study PL/SQL it is necessary install software Oracle Database 11g Express Edition. Hereafter you have 3 minutes video showing all necessary steps to installation correct.