Kafka CentOS Installation Instructions
If you’re here, you’re probably knows what `Kafka` is and what it should be used for.
If not, visit Apache Kafka page to learn more
In the following tutorial, I’ll demonstrate how to install Guest Additions on your VirtualBox hosted CentOS 7 Minimal machine.
Although this tutorial is intended for CentOS 7 minimal, it’s will probably also work on other CentOS releases.
centos postgresql :
PostgreSQL is a powerful, open source object-relational database system.
In the following tutorial I’ll show how to install PostgreSQL on your CentOS box
We can install PostgreSQL in (at-least) two ways:
yum install postgresql-server
If you want to install the latest version of PostgreSQL you should compile from source. it’s recommended for advanced users and one may argue it’s recommended too for production.
Anyway, this article from DigitalOcean covers this area well (and more). If you want to compile using source you better move to that article. If you prefer or installed using repository (yum), continue…
if you’ll try to start PostgreSQL using the service command, you will see an error tells you must init the db first and create the db files in: /var/lib//pgsql/data
to init on centos postgresql service use:
service postgresql initdb
This created a data folder in /var/lib/pgsql. You can’t run this command again without deleting first this folder (and all your data).
Also, when you called the initdb command above from RedHat’s init script configured permissions on the database. These configuration settings are in the pg_hba.conf file inside the data folder.
By default all permissions are ‘Ident’,
means the only user that can get in initially is user “postgres”, so if you’ll try ‘psql’ from root you’ll get error:
psql: FATAL: Ident authentication failed for user “root”
If you want to login and use postgres with other users than `postgres` you can change the permissions method in pg_hba.conf. change from ‘ident’ to ‘md5’ is recommended.
If you want to use phpPgAdmin (described later) you should change from ‘Ident’ to ‘md5’ or else it won’t login to your system.
If you need to change the default port (5432 by default) and Listen Addresses (localhost by default), you can set those vars inside the postgresql.conf inside /var/lib/pgsql/data folder.
#listen_addresses = 'localhost' #port = 5432
and then, to start on centos postgresql service use:
service postgresql start
to make centos postgresql load on boot use the chkconfig command as follows:
chkconfig postgresql on
and That’s it!
As I mentioned, default setup has ident authentication means the only user that can get in initially is user “postgres”, so if you haven’t changed permissions scheme you should su to postgres before.
to start ‘psql’ as postgres:
# change user to postgres su - postgres # start psql manager psql # CTRL + D twice to exit both psql and su. # You can also short the two commands into: # su postgres -c psql
Read this great tutorial.
PostgreSQL visual interface similar to phpMyAdmin? – in short, if you know phpMyAdmin and want phpPgAdmin, you need to add the EPEL repositories, Apache (yum install httpd) and then install using:
If your permissions scheme is currently ‘Ident’ you might need to change that to ‘md5’ as PhpPgAdmin requires it.
yum install phpPgAdmin
Then visit in your browser: http://localhost/phpPgAdmin
Edit /etc/httpd/conf.d/phpPgAdmin.conf if you want to allow access remotly and restart httpd (service httpd restart).
do you use pgsql, postgres, root, administrator as login or even user without password?
if you do, set the $conf[‘extra_login_security’] entry to false in your et/phpPgAdmin/config.inc.php.
If you really want to use the “postgres” role, make sure you set it up a password and $conf[‘extra_login_security’] is false.
use the command:
to change the system user password and
ALTER USER Postgres WITH PASSWORD 'password';
That alters the password for within the database. To change the password inside Postgresql. there is also short code (inside psql):
Which will ask from you a new password to set.
xrdp is a free open-source remote desktop server for Linux.
Installing xrdp on CentOS might be a little tricky since CentOS repositories does not contain the xrdp package.
Even the EPEL repository (Extra Packages Enterprise Linux) only contains an old version of xrdp.
DevOps/IT Specialist, Musician.
IT Manager – Faculty of Exact Sciences, Bar-Ilan University
centos luajit installation instructions – In the following tutorial I will show you how to install and use the LuaJIT Compiler on your CentOS box.
LuaJIT is a Just-In-Time Compiler (JIT) for the Lua programming language.
LuaJIT has been successfully used as a scripting middleware in games, appliances, network and graphics apps, numerical simulations, trading platforms and many other specialty applications. It scales from embedded devices, smartphones, desktops up to server farms. It combines high flexibility with high performance and an unmatched low memory footprint.
LuaJIT has been in continuous development since 2005. It’s widely considered to be one of the fastest dynamic language implementations. It has outperformed other dynamic languages on many cross-language benchmarks since its first release — often by a substantial margin.
LuaJIT is Copyright © 2005-2014 Mike Pall, released under the MIT open source license.
from LuaJIT website
you need to install a package for GCC before compiling LuaJIT, you can do that by:
yum install gcc
or better, install the development tools:
yum groupinstall “Development Tools”
Check the LuaJIT download page to check if newer version available. The next insructions are for the latest stable version currently available – LuaJIT-2.0.2
cd /opt wget http://luajit.org/download/LuaJIT-2.0.2.tar.gz tar -zxvf LuaJIT-2.0.2.tar.gz cd LuaJIT-2.0.2 make && make install # or sudo make install if you are not 'root'
OPTIONALLY, you can install LuaJIT using GIT. choose this method only if you want to be updated with the latests patches and updates and your don’t care about the risk of bugs. (NOT FOR PRODUCTION)
cd /opt git clone http://luajit.org/git/luajit-2.0.git cd luajit-2.0 make && make install # or sudo make install if you are not 'root'
That’s it. you have luajit installed.
consider the file ‘test.lua’:
print ("Hello, world!")
You can run (interpret) the file using
luajit -b test.lua test.out luajit test.out
more information about running luajit here.
That’s it! you have centos luajit installed.
centos gunicorn : In this simple tutorial I’ll explain how to install and run Gunicorn python server on your CentOS machine.
This tutorial is meant for Centos 6.4 and above but it should work on any CentOS 6.x release.
Gunicorn ‘Green Unicorn’ is a Python WSGI HTTP Server for UNIX. It’s a pre-fork worker model ported from Ruby’s Unicorn project. The Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resources, and fairly speedy.
before you going to install the centos gunicorn server you need to insure you have the python interperter installed (it should be, as it’s installed by default on the latest CentOS releases). to check that you have python use the command:
command not found of course means you need to install python now.
first make sure your have python installed. Simple as:
yum install python
test python by typing: “python” and you should see something similar to:
(Ctrl+D to exit)
Next we need to install gunicorn. for this we have (as always) several choices.
1) Using YUM. I personally don’t recommend it. I know some are happy to use the system packaging management wherever possible, but as for python I don’t think it’s the way to go.
To install gunicorn using yum:
yum install python-gunicorn
2) Using easy_install. using easy_install is a better choice for my taste to install python packages. this is how you install gunicorn using easy_install, but I recommend installing gunicorn using PIP as I will show next…
yum install python-setuptools easy_install gunicorn
3) Using PIP: This is my RECOMMENDED way of installing gunicorn. to install PIP you actually need easy_install so the commands are:
yum install python-setuptools easy_install pip pip install gunicorn
I can’t recommend enough to start working with virtualenv from beginning. At some point in the future, if you are going to consist with python coding, you are going to use the ‘pip update’ command to update some or all your libraries and then expect your python application to stop working.
Python libraries, as any open source library, have the freedom to sacrifice backward compatibility for new features, performance or redesign.
Virtualenv is a python virtual environment tool to ensure that your python applications will work as expected as long you don’t deliberately update some or all of the dependency libraries for that virtual environment specifically.
To install virtualenv (and virtualenvwrapper) and learn the basics read this tutorial. then create your virtual environment and install gunicorn to that environment.
# after you've install pip, virtualenv and virtualenvwrapper mkproject myapp workon myapp pip install gunicorn
$ gunicorn [OPTIONS] APP_MODULE
so for the following myapp.py file:
# -*- coding: utf-8 - def app(environ, start_response): data = 'Hello, World!\n' status = '200 OK' response_headers = [ ('Content-type','text/plain'), ('Content-Length', str(len(data))) ] start_response(status, response_headers) return iter([data])
gunicorn -w 4 myapp:app
# Sample output [INFO] Arbiter booted [INFO] Listening at: http://127.0.0.1:8000 [INFO] Worker spawned (pid: 16801) [INFO] Worker spawned (pid: 16802) [INFO] Worker spawned (pid: 16803) [INFO] Worker spawned (pid: 16804)
This command starts gunicorn with 4 workers on port 8000. feel free to experiment and customize the command with additional parameters.
There also command line for using Django <1.4 and Paster. read more here.
Read more about configuring Gunicorn and configuration files.
on deployment, It’s strongly recommended to use Gunicorn behind a proxy server.
I personally prefer nginx but it’s not your only choice.
Usally you’d want the gunicorn to be run in the background, load on boot and restart on errors. you want also the ability to monitor that process.
That it. enjoy playing with your centos gunicorn setup.