Search

My notebook

Month

August 2016

Install Nginx on CentOS 7

Step One—Add Nginx Repository

To add the CentOS 7 EPEL repository, open terminal and use the following command:

sudo yum install epel-release

Step Two—Install Nginx

Now that the Nginx repository is installed on your server, install Nginx using the following yum command:

sudo yum install nginx

After you answer yes to the prompt, Nginx will finish installing on your virtual private server (VPS).

Step Three—Start Nginx

Nginx does not start on its own. To get Nginx running, type:

sudo systemctl start nginx

If you are running a firewall, run the following commands to allow HTTP and HTTPS traffic:

sudo firewall-cmd --permanent --zone=public --add-service=http 
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

You can do a spot check right away to verify that everything went as planned by visiting your server’s public IP address in your web browser (see the note under the next heading to find out what your public IP address is if you do not have this information already):

http://server_domain_name_or_IP/

You will see the default CentOS 7 Nginx web page, which is there for informational and testing purposes. It should look something like this:

CentOS 7 Nginx Default

If you see this page, then your web server is now correctly installed.

Before continuing, you will probably want to enable Nginx to start when your system boots. To do so, enter the following command:

sudo systemctl enable nginx

Congratulations! Nginx is now installed and running!

How To Find Your Server’s Public IP Address

To find your server’s public IP address, find the network interfaces on your machine by typing:

ip addr
1. lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN

. . .
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

. . .

You may see a number of interfaces here depending on the hardware available on your server. The lointerface is the local loopback interface, which is not the one we want. In our example above, the eth0interface is what we want.

Once you have the interface name, you can run the following command to reveal your server’s public IP address. Substitute the interface name you found above:

ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'

Server Root and Configuration

If you want to start serving your own pages or application through Nginx, you will want to know the locations of the Nginx configuration files and default server root directory.

Default Server Root

The default server root directory is /usr/share/nginx/html. Files that are placed in there will be served on your web server. This location is specified in the default server block configuration file that ships with Nginx, which is located at /etc/nginx/conf.d/default.conf.

Server Block Configuration

Any additional server blocks, known as Virtual Hosts in Apache, can be added by creating new configuration files in /etc/nginx/conf.d. Files that end with .conf in that directory will be loaded when Nginx is started.

Nginx Global Configuration

The main Nginx configuration file is located at /etc/nginx/nginx.conf. This is where you can change settings like the user that runs the Nginx daemon processes, and the number of worker processes that get spawned when Nginx is running, among other things.

See More

Once you have Nginx installed on your cloud server, you can go on to install a LEMP Stack.

 

Full post  DigitalOcean

 

sys-unconfig

 

НАЗВАНИЕ

sys-unconfig – shell-скрипт для перенастройки системы во время следующей загрузки

СИНТАКСИС

sys-unconfig

ОПИСАНИЕ

sys-unconfig обеспечивает простой способ перенастройки системы под новую конфигурацию. При выполнении sys-unconfig остановит вашу систему и во время загрузки запустит следующие конфигурационные программы: passwd (для смены пароля root’а), netconfig, timeconfig, authconfig и ntsysv.

ФАЙЛЫ

/.unconfigured
Наличие этого файла заставит /etc/rc.d/rc.sysinit запустить программы, указанные выше.

Vmware Windows 2012 R2 template configuration–Recommended

image

  • Floppy Drive Removed
  • Memory 4GB
  • Hard Disk 40 GB – Keeping it low is good as you cannot reduce thin provisioned disk size.

Make sure Hot Add is enabled

  • Enable Memory Hot Add for this Virtual Machine
  • Enable CPU Hot Add only for this Virtual Machine

image

  • Check and Upgrade Tools during Power Cycling

image

  • Check Enable Logging

image

Get to Boot Screen to do some configurations –

image

  • Boot-Time Diagnostic Screen to Enabled

image

Change Boot Order to  –

  • Hard Drive
  • Removable Devices
  • CD-ROM Drive
  • Network boot

Use + to Toggle or Shift ` +

image

Advanced –> I/O Device Configuration Serial Ports/Parallel Ports/Floppy Disabled.

image

  • Install VMware Tools

image

Disabled IPv6

image

Allow Remote Desktop –

image

  • Set Time to Display List of Operating Systems to 5 Seconds
  • Set Time to Display recovery Options when Needed to 5 Seconds

image

Change Machine Name –

image

Make sure Windows is up to date –

  • As .NET 4.6.1 is not supported for Some Applications like Exchange. Not Installing it at this point of time (Optional).

image

Open PowerShell Run as Administrator and Cleanup C:\Windows\WinSxS folder which contains all the Updates which is almost 8GB

Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

This is a great command added with Windows 8.1 and Windows Server 2012 R2.  Essentially, it’s the mother of all commands. It cleanups and removes all the old superseded stuff from every component in the component store.

image

Change DVD ROM Drive Letter to Z: in Disk Management –

image

Control Panel – Notification Area Icons – Check Always Show All Icons and Notifications on the Taskbar

image

Power Options Set to High Performance

image

  • Proper Time Zone Updated in Server Manager
  • IE Enhance Security Configuration is set of OFF for Administrators only.

image

Start Run – Lusrmgr.msc – Local Administrator Account – Password Never Expires

image

Check – File Name Extensions

Windows Explorer – View –

image

Clear All Event Logs

Get-EventLog -List | foreach{Clear-EventLog -LogName $_.log}

image

  • Shutdown Windows 2012 R2 Template server

Windows Server 2012 Sysprep – %windir%\system32\sysprep

  • Convert to Template

 

Microsoft Recommendation –

  • Do not Disable User Access Control (UAC)
  • Do not Disable Windows Firewall

image

Deploy Virtual Machine From this Template –

image

Customization Specifications Manager to Join Domain Automatically –

image

image

Enter Local Administrator Password –

image

Network Settings

image

image

Enter Domain Information –

image

  • Check Generate New Security ID (SID)

image

  • Customize using an Existing customization Specification

image

Deploy Virtual Machine using Template –

image

image

Machine Joined Automatically –

image

Using PowerCLI – Import Multiple Virtual Machines using CSV

Original post.

How to upgrade PHP version 5.3.3 to 5.3.X

 

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

 

yum upgrade --enablerepo=remi php

 

Original post.

Mysql backup

Create folder

mkdir /etc/scripts

edit backup files

vim backup_mysql.sh
#!/bin/bash
 
USER="dbuser"
PASSWORD="dbpassword"
OUTPUT="/opt/backup_mysql/"
 
databases=`mysql --user=$USER --password=$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
 
for db in $databases; do
 if [[ "$db" != "information_schema" ]] && [[ "$db" != _* ]] ; then
 echo "Dumping database: $db"
 mysqldump --force --opt --user=$USER --password=$PASSWORD --databases $db > $OUTPUT/`date +%Y%m%d`.$db.sql
 gzip $OUTPUT/`date +%Y%m%d`.$db.sql
 fi
done

Delete old backups:

#!/bin/bash
find /opt/backup_mysql/* -mtime +6 -exec rm {} \;

Change permission:

chmod 700 backup_mysql.sh
Add task
crontab -e
#delete old backups
0 2 * * * SHELL=/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin /etc/scripts/delete_old_backups.sh > /dev/null 2>&1
#new backup
0 3 * * * SHELL=/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin /etc/scripts/backup_mysql.sh > /dev/null 2>&1

Setup IT Operational Portal Using iTop On CentOS/Debian

 

Using iTop you can:

– Document your entire IT infrastructure assets such as servers, applications, network devices, virtual machines, contacts.. etc.

– Manage incidents, user requests, planned outages.

– Document IT services and contracts with external providers including service level agreements.

– Export all the information in a manual or scripted manner.

– Import or synchronize/federate any data from external systems.

Features

– Fully configurable CMDB.
– HelpDesk and Incident Management.
– Service and Contract Management.
– Change Management.
– Configuration Management.
– Automatic SLA management.
– Automatic impact analysis.
– CSV import tool for all data.
– Consistency audit to check data quality.
– Data synchronization (data federation).

In this tutorial let us see how to setup the iTop on CentOS 6.5 and Debian 7, although it should work on RHEL, Scientific Linux 6.x and Ubuntu 13.10 as well.

Prerequisites

As it relies on apache, mysql and php, we need a server that has a working LAMP stack. To install LAMP server, refer the following articles that matches your platform.

Install LAMP server on CentOS/RHEL/Scientific Linux 6

Install LAMP server on Debian 7

Install LAMP server on Ubuntu 13.10

Then install the following php extensions.

On CentOS/RHEL/Scientific Linux:

# yum install php-mysql php-mcrypt php-xml php-cli php-soap php-ldap graphviz

On Debian/Ubuntu:

apt-get install php5-mysql php5-ldap php5-mcrypt
apt-get install php5-cli php5-soap php5-json graphviz

We need to adjust the following php settings for best performance. Edit file /etc/php.ini,

# vi /etc/php.ini

Set post_max_size as 32M.

[...]
post_max_size = 32M
[...]

Download iTap

You can download the latest version from here.

 # wget http://sourceforge.net/projects/itop/files/itop/2.0.2/iTop-2.0.2-1476.zip

Extract the zip file with command:

# unzip iTop-2.0.2-1476.zip

The above command extracts the zip file as a folder called ‘web’ in your current directory. Copy the ‘web’ folder contents to apache root folder.

# cp -fr web/ /var/www/html/itop

If you’re on a Debian/Ubuntu system, then the command would be:

# cp -fr web/ /var/www/itop

Create the following folders and make them to be writable.

# mkdir /var/www/html/itop/conf
# mkdir /var/www/html/itop/data
# mkdir /var/www/html/itop/env-production
# mkdir /var/www/html/itop/log
# chmod 777 /var/www/html/itop/conf/
# chmod 777 /var/www/html/itop/data
# chmod 777 /var/www/html/itop/env-production/
# chmod 777 /var/www/html/itop/log

Begin Installation

Let us start the installation by navigating to the URL http://ip-address/itop orhttp://domain-name/itop.

If everything Ok, you will see the following screen. Click Continue.

Welcome to iTop version 2.0.2 - Mozilla Firefox_001Select Install a New iTop and click Next.

Install or Upgrade choice - Mozilla Firefox_002Accept the License agreement.

License Agreement - Mozilla Firefox_003Create a new database for iTop.

Database Configuration - Mozilla Firefox_005Enter the password for admin account.

Administrator Account - Mozilla Firefox_006We’ve reached the end of installation. You’ll be asked to populate some sample data’s into your data. If you directly use it in production environment, then select the second option and Click Next. I want to populate my database with some demo data’s, so checked the first option.

Miscellaneous Parameters - Mozilla Firefox_008Click Next.

Configuration Management options - Mozilla Firefox_010Select the best choice of your IT environment and click Next.

Service Management options - Mozilla Firefox_012Select the type of your Ticket management. If you don’t like to have Ticket management system, you can skip it also.

Tickets Management options - Mozilla Firefox_013Select the type of tickets you want to use in order to manage changes to the IT infrastructure.

Change Management options - Mozilla Firefox_015Select the following options if you want to implement any additional ITIL processes.

Additional ITIL tickets - Mozilla Firefox_016Once you done with configuration, click Install.

Ready to install - Mozilla Firefox_018Congratulations! We’ve successfully installed iTop. Click on the Link Enter iTop to log in.

Done - Mozilla Firefox_019This is how my Dashboard looks with demo data.

Welcome to iTop - Mozilla Firefox_020That’s all now. Start learning iTop with demo data and manage your IT infrastructure like a boss.

Reference Links:

iTop Homepage

 

Original post – Link

Install LAMP Server (Apache, MySQL, PHP) On RHEL, CentOS, Scientific Linux 6.5/6.4

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

In this tutorial let us see how to setup LAMP server on RHEL/CentOS/Scientific Linux 6.x. Here x stands for version such as 6.1, 6.2, 6.3, 6.4, 6.5 etc.

My testbox hostname and IP address are server.unixmen.local and 192.168.1.101/24, respectively.

Install Apache

Apache is an open-source multi-platform web server. It provides a full range of web server features including CGI, SSL and virtual domains.

To install Apache, enter the following command from your terminal:

# yum install httpd -y

Start the Apache service and let it to start automatically on every reboot:

# service httpd start
# chkconfig httpd on

Allow Apache server default port 80 through your firewall/router if you want to connect from remote systems. To do that, edit file /etc/sysconfig/iptables,

# vi /etc/sysconfig/iptables

Add the following lines.

[...]
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEP
[...]

Restart iptables:

# service iptables restart

Test Apache:

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

Apache HTTP Server Test Page powered by CentOS - Mozilla Firefox_001

Install MySQL

MySQL is an enterprise class, open source, world’s second most used database. MySQL is a popular choice of database for use in web applications, and is a central component of the widely used LAMP open source web application software stack.

To install MySQL, enter the following command:

# yum install mysql mysql-server -y

Start the MySQL service and make to start automatically on every reboot.

# service mysqld start
# chkconfig mysqld on

Setup MySQL root password

By default, mysql root user doesn’t has password. To secure mysql, we have to setup mysql root user password.

# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):     ## Press Enter ## 
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n]     ## Press Enter ##
New password:                ## Enter new password ##
Re-enter new password:       ## Re-enter new password ##
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]     ## Press Enter ##
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]     ## Press Enter ## 
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]     ## Press Enter ##
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]     ## Press Enter ##
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

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:

# yum install php -y

Test PHP

Create a sample “testphp.php” file in Apache document root folder and append the lines as shown below:

# vi /var/www/html/testphp.php

Add the following lines.


Restart httpd service:

# service httpd restart

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

If you wanna to get MySQL support in your PHP, you should install “php-mysql” package. If you want to install all php modules just you use the command “yum install php*”

[root@server ~]# yum install php-mysql -y

Now open the phptest.php file in your browser using http://ip-address/testphp.php or http://domain-name/testphp.php. Scroll down and you will see the mysql module will be presented there.

phpinfo() - Mozilla Firefox_002Install phpMyAdmin

phpMyAdmin is a free open source web interface tool, used to manage your MySQL databases. By default phpMyAdmin is not found in CentOS official repositories. So let us install it using EPEL repository.

To install EPEL repository, follow the below link:

Install EPEL Repository On RHEL/CentOS/Scientific Linux 6

Now install phpMyAdmin

# yum install phpmyadmin -y

Configure phpMyAdmin

Edit the phpmyadmin.conf file.

# vi /etc/httpd/conf.d/phpMyAdmin.conf

Find and comment the whole /<Directory> section as shown below:

[...]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

#<Directory /usr/share/phpMyAdmin/>
#   <IfModule mod_authz_core.c>
#     # Apache 2.4
#     Require local
#   </IfModule>
#   <IfModule !mod_authz_core.c>
#     # Apache 2.2
#     Order Deny,Allow
#     Deny from All
#     Allow from 127.0.0.1
#     Allow from ::1
#   </IfModule>
#</Directory>
[...]

Open “config.inc.php” file and change from “cookie” to “http” to change the authentication in phpMyAdmin:

# cp /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php 
# vi /usr/share/phpMyAdmin/config.inc.php

Change cookie to http.

[...] 
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
[...]

Restart the Apache service:

# service httpd restart

Now you can access the phpmyadmin console by navigating to http://server-ip-address/phpmyadmin/ from your browser.

Enter your MySQL username and password which you have given in previous steps. In my case its “root” and “centos”.

phpMyAdmin - Mozilla Firefox_003Now you will be redirected to the phpmyadmin dashboard.page as shown below.

192.168.1.101 - localhost | phpMyAdmin 4.1.2 - Mozilla Firefox_004

Now you will able to manage your MariaDB databases from phpMyAdmin web interface.

That’s it. Your LAMP server is up and ready to use.

Original post – link

IBM IMM (Integrated Management Module) Defult Username and Password

Default login credentials for IBM IMM (Integrated Management Module) are as follows:

 

  • Username: USERID
  • Password: PASSW0RD

Both username and a password are case sensitive so they have to be in block capitals. Please notice there is a zero ‘0’ in the word PASSWORD instead of letter ‘O’.

Thanks

 

Create a free website or blog at WordPress.com.

Up ↑