Skip to main content

Posts

SETTING STATIC IP IN SUSE 11

To set static ip we can use yast command
#yast
From the table that appears select Network services > Network settings


Go to address and set ip,netmask and hostname




Then from Hostname/DNS give hostname and nameserver details


 Then from Routing give gateway


Afterthat click ok and restart network service
#service network restart

(note:the configuration file is /etc/sysconfig/network/ifcfg-interfacename)

LEMP ON CNTOS 6.9

LEMP is a combination of operating system and open-source software stack. The acronym LEMP is derived from first letters of Linux, Nginx HTTP Server, MariaDB database, and PHP/Perl/Python

First install epel-relese package
#yum install epel-release
Now install nginx
# yum install nginx -y
# service nginx start
# vi /etc/nginx/nginx.conf
worker_processes 1;
# vi /etc/nginx/conf.d/default.conf
--------------------------------------------------------------------------
server  {
    listen       80;
    server_name  your sever ip;
    #charset koi8-r;
    #access_log  logs/host.access.log  main;
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
    error_page  404              /404.html;
    location = /404.html {
        root   /usr/share/nginx/html;
    }
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
  …

VSFTPD SERVER WITH MULTIPLE USERS ABLE TO ACESS SHARED FOLDER

First install vsftpd package
#yum install vsftpd -y

Open vsftpd configuration file and the check the directives is as follows(if not present add it)
#vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO  (restricting anonymous users)
local_enable=YES (When enabled, local users are allowed to log into the system.)
local_root=/test (this mention the root directory of ftp server)
pasv_promiscuous=YES (if gave no the ftp server will checks wheather the client is connecting to transfer port and control port is same and if we give yes it will not check )

Now start the service
#service vsftpd start
create directory
#mkdir /test
create a group which have acess to out ftp directory
#groupadd ftpgroup
create a user with no shell login and home directory /test under ftpgroup
#useradd -g ftpgroup -s /sbin/nologin ftpuser1
#useradd -g ftpgroup -s /sbin/nologin ftpuser2
set password for ftpuser1 and ftpuser2
#password ftpuser1
#chmod 775 /test
#chown ftpuser1:ftpgroup /test

Now go to client server.Try a…

HAPROXY LOADBALENCER FOR HTTPD ON CENTOS 7

CREATING HARDLINKS AND SOFTLINKS

There are mainly two type of links in linux that we use - hard links and soft links.
HARDLINKS
We can create hardlinks only for files.If we create hatdlink for a file the file really exist as a copy.Also syncing of contents will also occur.Eventhogh if we deleted the original file hardlink exist.Both will have different inode number.

ln test /var/hard
this command will ctrete a hardlink named hard for file test.

SOFTLINKS
We can create softlinks for files and folders.It is just a symbolic link pointing towars original file.Both will have same inode number.

ln -s test /var/soft
this command will ctraete a softlink named soft for file test.
If the symbolic link already exist, we may get an error, to force the operation (remove exiting symbolic link), use the -f option.
ln -sf test1 /var/soft

CONVERTING HARDLINK TO SOFTLINK
To make a hard link directly into a soft link, use the -P flag like this
ln -P harlinkname softlinkname

VNSTAT ON CENTOS 7

For installing vnstat we want to enable epel-release first.
#yum install epel-release -y
#yum update

Now install vnstat package
#yum install vnstat -y

Consider enps08 is our interface.Vnstat defaultly detects on eth0 interface.So we want to enable it in configuration file.
#vi /etc/vnstat.conf
Interface enps08





#service vnstat start
Then add the enp0s8 interface to database
#vnstat -i enp0s8 
Now change the permission of database file /var/lib/vnstat/enp0s8
#chmod 777 /var/lib/vnstat/enp0s8
Now restart vnstat service
#service vnstat restart
#vnstat -d





This will give report of the day regarding transmitted data received data and total data

TO SET PASSWORD AUTHENTICATION WITH APACHE ON UBUNTU 16.04 USING .HTACCESS FILE

1.Install apache2
#apt-get install apache2

2.Create a Password file
We now have access to the htpasswd command. We can use this to create a password file that Apache can use to authenticate users. We will create a hidden file for this purpose called .htpasswd within our /etc/apache2 configuration directory.
#htpasswd -c /etc/apache2/.htpasswd arun

Leave out the -c argument for any additional users you wish to add:
#htpasswd  /etc/apache2/.htpasswd Rahul

If we view the contents of the file, we can see the username and the encrypted password for each record:
#cat /etc/apache2/.htpasswd
arun:$apr1$zgRuzA6/$RSvqTSJPxikIXEKxgYu4f0
rahul:$apr1$yX/HaM9G$S0vY8PfVef0JhG66xsCFq.


3.Configuring Access Control with apache2 configuration file: #vi /etc/apache2/apach2.conf Add the following entries <Directory /var/www/html/test>       Options Indexes FollowSymLinks       AllowOverride All       Require all granted       AuthType Basic       AuthName "Restricted Content"       AuthUs…

CREATING SUDO USERS/GROUPS IN CENTOS/UBUNTU

1.By adding user to group having sudo privilege

UBUNTU
First create a user to which we want to have sudo privileges.Here arun is the user to which we are assigning sudo privilege.
#useradd arun
Set a password for user arun
#passwd arun
Set the password
Add this user to sudo group. By default, on Ubuntu, members of the sudo group have sudo privileges.
#usermod -aG sudo arun
Now switch to user arun.
#su arun
Now we can start using sudo privileges.For example
$sudo ls -al

Note:For ubuntu under ubuntu 11.0 we can use sudo group as admin

CENTOS
First create a user to which we want to have sudo privileges
#useradd arun
Set a password for user arun
#passwd arun
Set the password
Add this user to sudo group. By default, on Ubuntu, members of the sudo group have sudo privileges.
#usermod -aG wheel arun
Now switch to user arun.
#su arun
Now we can start using sudo privileges.For example
$sudo ls -al


2.By visudo #useradd popy #passwd popy Set a password for user popy Here we are creating a new use…

NAGIOS 4.2.0 SERVER/CLIENT CONFIGURATION IN CENTOS

Nagios is a best server monitoring software on the market. Server monitoring is made easy in Nagios because of the flexibility to monitor your servers with both agent-based and agentless monitoring.In this article we will explain about configuring nagios server and host which we will monitor.

Install the required packages
#yum install -y httpd php gcc glibc glibc-common gd gd-devel make net-snmp

Create a new nagios user and nagcmd group account and set a password.
# useradd nagios
# groupadd nagcmd
add both the nagios user and the apache user to the nagcmd group.
# usermod -G nagcmd Nagios
# usermod -G nagcmd apache

Download Nagios Core 4.2.0 and Nagios Plugin 2.1.2
#mkdir /root/nagios
#cd /root/Nagios

Now download latest Nagios Core 4.2.0 and Nagios plugins 2.1.2 packages with wget command.
# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.2.0.tar.gz
# wget https://www.nagios-plugins.org/download/nagios-plugins-2.1.2.tar.gz

Extract the downloaded files
# tar -xvf…