CentOS 7 comes with the hostnamectl utility to read and write hostname.
To view the hostname simply run the command:
Golix: Hello there. I have an announcement to make. We are excited to launch our coffee shop where you can listen to music. The new business is ready to rock and roll.
After a year.
Golix: We have an announcement to make. We are shutting down the music service in our coffee shop. Now you can just drink coffee. No music.
Journa: Golix, why are you shutting down the music business?
Golix: For business reasons.
Journa: We thought you were a cool kid. Your explanation is so uncool.
FPM, FastCGI Process Manager is a PHP FastCGI implementation. Using php-fpm you can have a website running as its own user instead of a common user like Apache or www-data. In this post, we will go through the process of installing and configuring php-fpm with Nginx on CentOS 6.
php-fpm package is available in the official CentOS repository. There is no need to enable third party repositories in order to use php-fpm.
nginx package is available in Fedora EPEL repository.
Enable Fedora EPEL.
In this tutorial, I will provide step by step process to setup MySQL replication. We will create one master and one slave. We will use two CentOS 6 servers - one for master and the other for slave. This following steps have been tested on two virtual machines.
Our master server will have IP address 192.168.122.10.
Our slave server will have IP address 192.168.122.12.
You might want to run SELinux in permissive mode.
Perform these steps on the master:
Install MySQL server.
yum install mysql-server -y
- Python where we can, C++ where we must.
- CLI where we can, web where we must.
- Use available software where we can, write our own where we must.
- Open source software where we can, proprietary software where we must.
- Upstream where we can, patch where we must.
- Bash where we can, others where we must.
- Nginx where we can, Apache where we must.
- JSON where we can, XML where we must
- POST where we can, GET where we must
- REST where we can, RPC where we must
openssl is a command line tool to use various cryptography functions.
The req command of openssl provides PKCS#10 X.509 Certificate Signing Request (CSR) management facilities.
We will generate a new certificate request for the domain
openssl req -new -nodes -keyout www.example.com.key -out www.example.com.csr
If you have to insert comment on several lines do you do manually insert the comment character in every line? Stop. Vim is a really good editor and has a nice feature to accomplish this quickly. Here are the steps:
- Enter visual blocking mode by pressing CTRL V (CTRL key and the lowercase v).
- Make your selection using motion keys(jklm, etc).
- Press I(uppercase I) to enter block insert mode.
- Press #, the comment character.
- Press Esc key. The comment character # will be inserted on each line the visual block selection.
(datetime.datetime(datetime.datetime.today().year, datetime.datetime.today().month, calendar.monthrange(datetime.datetime.today().year, datetime.datetime.today().month)) - datetime.datetime.today()).total_seconds()
There's a log going on in that one liner. Let's break it down.
The two key Python modules we need to calculate the number of seconds till the end of year are datetime and calendar.
calendar.monthrange(year, month) returns a tuple. The tuple's second element is the number of days in the month.
We create two date objects:
Here's a quick tip for Mercurial users.
Travel back in time and see how the file appeared. :)
hg cat --rev "date('2011-05-03')" controllers/crons.py
Let's break it down.
hg cat is the command we use to print the given revision of file.
hg cat --rev 10885:ae28ee103fed controller/crons.py
would print the file for the revision 0885:ae28ee103fed.
Mercurial supports a functional language for selecting a set of revisions. To know more about it try:
hg help revsets
In our solution: