Tuesday, 20 October 2015

IT And Asset Management System With GLPI On Centos6/ RHEL 6

GLPI is the Information Resource-Manager with an additional Administration Interface. You can use it to build up a database with an inventory for your company. It has enhanced functions to make the daily life for the administrators easier, like a job-tracking-system with mail-notification and methods to build a database with basic information about your network-topology.

Install GLPI on Centos 6 or RHEL6

Let us setup GLPI Asset management system using GLPI on our centos 6.6. GLPI is web based deployment software, we have to setup a LAMP server in our centos 6.6. Follow the below link to setup LAMP server on centos 6


Now we have to create a database for GLPI. To do so, log in to your MySQL server using command:

# mysql -u root -p
Now create a database called ‘glpidb’ and database user called ‘glpiuser’ with password ‘redhat’ as described below.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 190
Server version: 5.5.31-0+wheezy1
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database glpidb;
Query OK, 1 row affected (0.02 sec)
mysql> grant all on glpidb.* to glpiuser@localhost identified by 'redhat';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit

Bye

Getting GLPI

Download the latest GLPI package here. Or you can directly download it from your terminal using command:

# wget https://forge.indepnet.net/attachments/download/1615/glpi-0.84.3.tar.gz
Extract the tarball using command:
# tar -zxvf glpi-0.84.3.tar.gz
Move the extracted files to your webserver root document folder.
# mv glpi/ /var/www/html
Set Read/Write permissions of the following directories.
# chmod -R 777 /var/www/html/glpi/files/
# chmod -R 777 /var/www/html/glpi/config/
Begin Installation
The rest of the installation is web based and pretty easy. Point your web browser with URL http://ip-address/glpi or http://domain-name/glpi and follow the onscreen instructions.

You should see the following screen. Select your language and click Ok.


Accept the License agreement and click Ok.

If it is a new installation click Install button, else click Upgrade button to upgrade from old version to most recent new version. I want to install a fresh version of GLPI, hence i clicked Install button
.


If all seems well, you should see the following screen. If there are any errors, check for the file permissions and start over the installation again.

Enter the MySQL credentials such as hostname, user and password and click Continue.

If you have already created a MySQL database it should have listed in the next screen as shown below, else you have to create a new one by clicking on the link Create new database. I have already created a database called ‘glpidb’, hence i selected it.



Click Continue.


Congratulations! We have installed GLPI on our server successfully.

The default user accounts and their passwords will be shown in the above window. However i have listed them below for the sake of clarity.

– glpi/glpi for the administrator account
– tech/tech for the technician account
– normal/normal for the normal account
– post-only/postonly for the postonly account

Please note them. You can change them later.


Click Use GLPI to proceed. Let us log in to GLPI administrative Dashboard. The administrative user name is glpi and password is also glpi. Enter them and click Post.


This is how my Administrative dashboard looks.

At the first log in it will show some precautions that be made before using GLPI further.


First you above to change the default users passwords for security reasons. To do that. Go to Administration -> Users -> glpi and input your new password in the password column.

And also you have to remove the install/install.php file for security reasons.

# rm -fr /var/www/glpi/install/install.php
If you made any mistakes or just forgot the password for the administrative account, you can re-run the above setup by deleting the following config/config.php file.

After completing your installation change the permission of the config/config_db.php file to avoid any misconfiguration by users.

# chmod 400 /var/www/glpi/config/config_db.php
Now start using GLPI asset management system by navigating to http://ip-address/glpi.

Usage of GLPI is not that difficult. Just go-through every menus and explore things. If you still want a help documentation, i suggest you to read the Official wiki page.

References: GLPI Project

Saturday, 12 September 2015

How to copy file in linux platform...



Copy one single local file to a remote destination
scp /path/to/source-file user@host:/path/to/destination-folder/
  
Copy one single file from a remote server to your current local server
scp user@host:/path/to/source-file /path/to/destination-folder  

Copy one single file from a remote server to another remote server
scp user1@server1:/path/to/file user2@server2:/path/to/folder/

Copy one single file from a remote host to the same remote host in another location
scp jane@host.example.com:/home/jane/table.csv pete@host.example.com:/home/pete/

Copy multiple files with one command
scp file1.txt file2.txt file3.txt pete@host.example.com:/home/pete/

Copy all files of a specific type
scp /path/to/folder/*.ext user@server:/path/to/folder/

Copy all files in a folder to a remote server
scp /path/to/folder/* user@server:/path/to/folder/

Copy all files in a folder recursively to a remote server
scp -r /home/user/html/* jane@host.example.com:/home/jane/backup/

Copy a folder and all its contents to a remote server
scp -r /path/to/source-folder user@server:/path/to/destination-folder/

Specify a port
scp -P [port] [user]@[server]:[path/to/]file [/path/to/]file

Tuesday, 7 July 2015

How to Set SSH Login Email Alerts in CentOS/Redhat Enterprise Linux/Ubuntu/ Debian/Linux Mint /Fedora

On Debian/Ubuntu/Linux Mint
# apt-get install mailx

On RHEL/CentOS/Fedora
# yum install mailx

Set SSH Root Login Email Alerts
# cd /root
# vi .bashrc

Add the following whole line at the bottom of the file. Make sure to replace “ServerName” with a hostname of your Server and change “your@yourdomain.com” with a your email address.

echo 'ALERT - Root Shell Access (ServerName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" your@yourdomain.com

Save and close the file and logout and log back in. Once you login via SSH, a .bashrc file by default executed and sends you an email address of the root login alert.

Set SSH Normal User Login Email Alerts
Login as normal user (amir) and go to user’s home directory by typing cd /home/amir/ command.

# cd /home/amir

Next, open .bashrc file and add the following line at end of the file. Make sure to replace values as shown above.

#vim .bashrc

echo 'ALERT - Root Shell Access (ServerName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" your@yourdomain.com

Save and close the file and logout and login again. Once you login back again, a .bashrc file executed and sends you an email address of the user login alert.



Monday, 6 July 2015

How to configure vncserver CentOs 6/RHEL 6


Install Desktop Environment

For GNOME:
# yum groupinstall  "General Purpose Desktop" "Desktop Platform"

For KDE:
# yum groupinstall  "KDE Desktop"

Install VNC server
# yum -y install vnc-server

Install   Tigervnc-Server
# yum install tigervnc-server

Make vnc password for user (Ex. amir). Login to the user and run the following command:
#vncpasswd amir
Password:
Verify:
Configure VNC configuration for new user

Edit /etc/sysconfig/vncservers file and add the user name:

#vim /etc/sysconfig/vncservers
VNCSERVERS="2:amir"
VNCSERVERARGS[2]="-geometry 1280x1024"
Save and exit

#service vncserver restart
#chkconfig vncserver on

Done…

Thursday, 2 July 2015

How to use .htaccess file on Apache server



You need to have AllowOverride AuthConfig directive in httpd.conf file in order for these directives to have any effect. Look for DocumentRoot Directory entry. In this example, our DocumentRoot directory is set to /var/www. Therefore, my entry in httpd.conf looks like as follows:

<Directory /var/www/html>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Save the file and restart Apache
 
If you are using Red Hat /Fedora Linux:
# service httpd restart


If you are using Debian Linux:
# /etc/init.d/apache-perl restart


Wednesday, 1 July 2015

How To Install LAMP Stack On Ubuntu 15.04

How To Install LAMP Stack On Ubuntu 15.04

1. Install Apache
To install Apache…
#apt-get install apache2

Test Apache:
Open your web browser and navigate to http://localhost/ or http://server-ip-address/.

2. Install MySQL
#apt-get install mysql-server mysql-client
During installation, you’ll be asked to setup the MySQL “root” user password. Enter the password and click Ok.
MySQL is installed now.

You can verify the MySQL server status using command:

On Ubuntu 15.04:
#ssystemctl status mysql

On Ubuntu 14.10 and previous versions:
#service mysql status

Mysql initial setting…
#mysql_secure_installation
#service mysql status
3. Install PHP
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.

Install PHP with following command:
#apt-get install php5 php5-mysql libapache2-mod-php5

To test PHP, create a sample “test.php” file in Apache document root folder.

#vim /var/www/html/testphp.php
Add the following lines.
<?php
phpinfo();
?>

Restart apache2 service.

On Ubuntu 15.04:
#systemctl restart apache2

On Ubuntu 14.10 and lower versions:
#service apache2 restart

Navigate to http://server-ip-address/test.php. It will display all the details about php such as version, build date and commands etc.

4. Install phpMyAdmin
phpMyAdmin is a free open-source web interface tool used to manage your MySQL databases. It is available in the Official Debian repositories. So install it with command:

#apt-get install phpmyadmin
Select the Web server that should be automatically configured to run phpMyAdmin. In my case, it is apache2.

Enter password of the database’s administrative user.
Enter MySQL application password phpmyadmin.
Re-enter the password.
Success! phpMyAdmin installation is installed.

Additional Note: if you followed all steps carefully, phpMyAdmin should work just fine. In case phpMyAdmin is not working, please do the following steps.
Open terminal, and type:
#vim /etc/apache2/apache2.conf
Add the following line at the end.

Include /etc/phpmyadmin/apache.conf
Save and Exit.

Restart apache service:

On Ubuntu 15.04:
#systemctl restart apache2

On Ubuntu 14.10 and lower versions:
#/etc/init.d/apache2 restart


Done… 

How to enable root login ubuntu-15.04-server

                
The root user in Ubuntu is disabled by default because his password is not set. But if you'd like to use root user by some reason, enable it like follows.

Set root password.

root@amir:~$ sudo passwd root
Enter new UNIX password:                    # set root password
Retype new UNIX password:                # confirm
passwd: password updated successfully

root@amir:~$ su -
Password:                           # root password
root@amir:~                       ## just switched             

If you enable root, limit users to switch to root.

root@amir:~# vi /etc/pam.d/su
# line 15: uncomment and add a group that can switch to root
auth   required   pam_wheel.so   group=adm

root@amir:~# usermod -G adm root

End...

How to install clamAV on Centos 6

  Install EPEL repo: Before we can do proceed, you must ensure that you have the EPEL yum repository enabled. To do this, CentO...