Overview
Linux chmod has a few options that can make your life a lot easier when managing a shared storage.
The most needed are chmod suid sgid sticky bit.
Also the impact of each one is different between files and folders.
Continue reading
Linux chmod has a few options that can make your life a lot easier when managing a shared storage.
The most needed are chmod suid sgid sticky bit.
Also the impact of each one is different between files and folders.
Continue reading
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.
Continue reading
ydpg17 reset – You may know this console as YinLips, Innova or whatever your country importer decides.
to reset your YDPG17 android box – Start your YDPG17 games console with ‘POWER‘ + ‘M‘ buttons pressed. after the console start loading leave the power button and continue holding the M button until you’ll get into the menu.
to navigate in the menu (it may be different for your console):
use the wheel to move between options and power button to select.
Choose (3) Only format data and cache area.
ydpg17 reset
that’s it.. you’ve reset your ydpg17 game console back to default.
Cheers!,
centos luajit installation instructions – In the following tutorial I will show you how to install and use the LuaJIT Compiler on your CentOS box.
Before you continue you should already know what is Lua and JIT Compiler.
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 test.lua
luajit -b test.lua test.out luajit test.out
more information about running luajit here.
That’s it! you have centos luajit installed.
Cheers!.
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.
From: Gunicorn – Python WSGI HTTP Server for UNIX:
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:
python
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
Basic usage:
$ 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])
just run:
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.
If you want to install nginx on your CentOS machine follow this installation instructions.
use this script (at github) to configure your nginx to pass request to the gunicorn process
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.
There are several tools for that.job, including: Supervisord, Gafferd, runit and many more… choose what fits you best. here you have examples for monitoring gunicorn using those tools.
That it. enjoy playing with your centos gunicorn setup.
CentOS Tomcat
centos tomcat
“Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed under the Java Community Process.” from Tomcat homepage.
before we’ll continue the installation of Tomcat, the JDK (Java Development Kit) should be installed on your CentOS machine. to check for Java support use the command:
java -version
if bash returns ‘command not found‘ then continue to the next step and install the JDK, else skip the step and continue to Tomcat server installation.
To install the jdk we have 2 options:
I’ll explore both:
For beginners and testing purposes you should go with this option.
Why should I use the Oracle JDK over the OpenJDK, or vice-versa? [closed]
The command to install JDK using YUM is very simple:
yum install java
Check you have installed it right:
Download your required JDK here.
Note: I can’t give you an WGET command to download, because you need to Accept License Agreement before downloading any file.
You can download and install using the RPM or the tar.gz (both with x86 or x64) on your CentOS machine:
In case of our CentOS we can download and install the .rpm file or the .tar.gz file.
RPM can be installed ONLY by the root.
TAR.GZ can be installed be any user on the computer.
make sure to uninstall older installations (if any):
rpm –e <package name>
To install the jdk using the downloaded rpm use the rpm command:
rpm –ivh jdk-7u45-linux-x64.rpm
If you just want to upgrade a package you’ve already installed use the -Uvh parameter.
rpm –Uvh jdk-7u45-linux-x64.rpm
Delete the .rpm file if you want to save disk space.
Read more about installation of Oracle Java on Centos here on ItekBlog
Use alternatives :
alternatives –install /usr/bin/java java /usr/java/latest/jre/bin/java 20000
alternatives –install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000
and config your default jdk (if you have more then one) using:
using:
alternatives –config java
Just as in the first step: type java -version to see if your have jdk installed.
The advantage of tar.gz installation of the JDK is that we can able to install multiple version of java if required.
The archive can be installed by anyone (not only root users), in any location that you can write to. However, only the root user can install the JDK into the system location.
You need to unpack the .tar.gz file (using tar -xzf) into the the location where you would like the JDK to be installed.
Unpack the tarball and install the jdk:
tar zxvf jdk-7u<version>-linux-i586.tar.gz
Delete the .tar.gz file if you want to save disk space.
Use alternatives :
alternatives –install /usr/bin/java java /path/to/jdk1.7.0_45/bin/java 2
alternatives –config java
read more about installation of jdk in the oracle documentation.
for extended installation tutorial read this post by adam in this blog.
read more on What is the difference between jdk 1.6 and 1.7 ?
1 | JAVA_HOME |
is a
1 | environment |
variable (in Unix terminologies), or a PATH variable (in Windows terminology) you need to create to point to where Java is installed. ($JAVA_HOME/bin/java should execute the Java runtime).
To set it for your current session type at bash:
export JAVA_HOME=/usr/java/jdk1.7.0_05
export PATH=$PATH:$JAVA_HOME/bin
To set the JAVA_HOME permanently we need to add the commands to the ~/.bash_profile file of the user.
We can also add it /etc/profile and then source it to give to all users.
use the echo command to check you’ve configured the variables:
echo $JAVA_HOME
echo $PATH
After we have java installed and tested we can continue to the installation of the Tomcat server.
Since Apache Tomcat is distributed as binaries, all you have to do is to download it and start it.
Download apache-tomcat-x.x.xx.tar.gz (latest version or any) from Apache Tomcat Homepage
I’ll go with the tomcat 8 – tar.gz package.
and using command:
cd /usr/share
wget http://apache.spd.co.il/tomcat/tomcat-8/v8.0.0-RC10/bin/apache-tomcat-8.0.0-RC10.tar.gz
verify and extract the download using::
md5sum apache-tomcat-8.0.0-RC10.tar.gz
tar xvzf apache-tomcat-8.0.0-RC10.tar.gz
and I have a /usr/share/apache-tomcat-8.0.0-RC10 folder now.
Tomcat by default start on port 8080 you can start the server now by typing at bash:
cd apache-tomcat-8.0.0-RC10
./bin/startup.sh
Now Access the tomcat by connecting your server with a web browser on port 8080.
http://localhost:8080
If you cannot access the above Tomcat page, make sure to stop iptables (since CentOS has iptables on by default set to block the Tomcat’s default listening port 8080).
service iptables stop
to permanently disable iptables (NOT RECOMMENDED AT ALL) use:
chkconfig iptables off
Locate server.xml in {Tomcat installation folder}/conf/ which is at /usr/share/apache-tomcat-8.0.0-RC10/conf in our case
Find the following:
<!-- Define a non-SSL HTTP/1.1 Connector on port 8180 --> <Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />
and change the 8080 port to your required port.
To start the tomcat service on system boot create the file /etc/init.d/tomcat8 (I am using vi /etc/init.d/tomcat8) and fill it with:
#!/bin/bash # description: Tomcat Start Stop Restart # processname: tomcat # chkconfig: 234 20 80 JAVA_HOME=/usr/java/jdk1.7.0_05 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH CATALINA_HOME=/usr/share/apache-tomcat-8.0.0-RC10 case $1 in start) sh $CATALINA_HOME/bin/startup.sh ;; stop) sh $CATALINA_HOME/bin/shutdown.sh ;; restart) sh $CATALINA_HOME/bin/shutdown.sh sh $CATALINA_HOME/bin/startup.sh ;; esac exit 0
Now set the permissions on the file and the catalina.sh file:
chmod a+x /etc/init.d/tomcat8 chmod a+x /usr/share/apache-tomcat-8.0.0-RC10/bin/catalina.sh
to start/stop/restart the service use:
service tomcat8 start service tomcat8 restart service tomcat8 stop
to start the service on boot use:
chkconfig --add tomcat8 chkconfig tomcat8 on
to disable it later you can use off instead of on:
chkconfig tomcat8 off
That’s it! you have your CentOS Tomcat server working and runing…
dd-wrt set date manually – In this tutorial I’ll explain how to set the date and time in dd-wrt based routers.
My dd-wrt system is dd-wrt v24-sp2 (11/02/09) std
(SVN revision 13064M VINT Eko).
It may not work on your system but I’ll explain the basics so you should be able to find your own way.
in dd-wrt set date manually using command-line. you can do this by:
Becuase ssh is not opened by default on all dd-wrt machines I’ll explain how to set the date and time using the second method – using the web interface. but the same command and rules apply also to SSH connection.
go to your dd-wrt admin managment panel on your browser and view the Administration / Commands page. it may be different in your system version but you should able to find quickly where the Commands page is.
You can use the Date command inside your dd-wrt box to read and set your system time and date.
to view your current date as configured in your dd-wrt machine use the ‘date‘ command.
Just fill the commands input box with ‘date’ and click on the ‘Run Commands‘ button.
date
Here it may be tricky. I’ve found several online blogs and manuals but nothing worked. to set the dd-wrt date manually I’ve succeded with the following command:
date 022720012014
Month | Day | Hours | Minutes | Year |
02 | 27 | 20 | 01 | 2014 |
that’s it. I hope It helped you to configure your dd-wrt set date manually.
CentOS G-WAN server
G-WAN is a web server with scripts in Asm, C, C++, C#, D, Go, Java, Javascript, Lua, Objective-C, Perl, PHP, Python, Ruby and Scala.
G-WAN better uses CPU Cores
to make the Internet of Things
fly thousand times higher !Leverage legacy servers and
low-consumption CPUs to
do more with less!
G-WAN works best on Linux distributions like Debian or CentOS, both of which offer ‘Desktop’ and ‘Server’ flavors.
CentOS G-WAN installation instructions
choose a location for your installation. for demonstration purposes we’ll install G-WAN to /opt
cd /opt wget http://gwan.com/archives/gwan_linux64-bit.tar.bz2 tar -xjf gwan_linux64-bit.tar.bz2; cd gwan_linux64-bit sudo ./gwan
use the 32bit version instead (http://gwan.com/archives/gwan_linux32-bit.tar.bz2) if you need.
Then, type http://localhost:8080/ in your browser
and play with the/gwan/.../csp samples.
If you want to install more Programming Languages read the FAQ – Setup of Programming Languages
To install all 15 languages using the bash script donated by generous user on many Linux distributions (Debian, LinuxMint, CentOS, Fedora, RedHat, Manjaro, Arch Linux and Bridge) use:
cd /opt
wget http://www.as2.com/linux/tools/G-WAN_full-install.tar.bz2
tar -xjf G-WAN_full-install.tar.bz2
./G-WAN_full-install
The installation menu is available in English, German, French and Spanish!
To start G-WAN as a service (make it start automatically at boot time) use this instructions
with one exception for CentOS in the manual:
instead of:
sudo update-rc.d gwan defaults 95 5
use:
sudo chkconfig gwan on
and you don’t need to restart.
check the API and Frequently Asked Questions.
Stackoverflow lists many more examples and will let you search for replies to common questions.
And that’s it. you have G-WAN server.
How to speed up website load time is important question for those that performance matters to them.
Nobody Likes a Slow Website!
How to speed up website?
Website optimization is a required step for production, and when is automated when possible correctly it can help you deliver your website as fastest as possible without compromising on development comfortability and code readability.
How to speed up website question could be answered for your case better if you’ll use a website speed test tools. There several good websites load time speed tests available online for free. check out pingdom website speed test, Google PageSpeed tools. this are very good tools which also gives you important and valuable information and tips to speed up your website.
You can also check: WebPagetest, GTmetrix or PageScoring Website Speed Test.
Some of them rates your website and/or explain what could be done to make your site faster. you can learn also a lot from loading time graphs.collect information from all the above to optimize your website to maximum.
if your score is bad.. continue reading How to speed up website
How to speed up website load time
So, how to speed up your website load time?
You can do that using several tweaks.. one at a time…
Use the mentioned websites speed test graphs to learn what are the slowest parts of your website and start with them. does the problem is with your webserver or maybe the infrastructure?
How to speed up website ? Does your static files load time is the problem?
And maybe it is the dns? processing request? loading the images? loading the scripts? maybe you have bad requests?
This extreme powerfull tool will help you learn your weaks and strongs.
If your website on load check if it’s mobile or not, then it redirect to another page when checks the language and then redirects to another page who check the cookies and then redirect… well you’ve got the idea. Bad design pattern!
Minimize redirects!
Set up your server to return Expire and Cache-Control headers with static files. Setup you expire date to be within week or more is a very good timeframe (depend on how frequently you update your website static files you can setup the expire date as required).
A Content Delivery Network (CDN) can be an important tool in achieving decent page load and web application speeds. Providers such as Akamai, EdgeCast, Amazon (CloudFront), Rackspace (CloudFiles), Google (PageSpeed) and Microsoft (Azure CDN) are providing the means to distribute your content to locations geographically closer to your customers/users, which improves the responsiveness of the application or website.
Although using a CDN can help with page load speeds, a CDN is not always the best solution in terms of Cost–benefit.
when configuring a cache server before your website server, and no matter if it’s apache, tomcat, gunicorn or any other html generator you can boost up clients page load dramatically.
caching the compiled html pages is very important speed tweak. if you have any static and/or low-rate updated pages with no problem if some users will not see the lastest updates of the html when it changes (until cache reloads).. check varnish-cache or squid-cache or nginx (with HttpProxy module) or Apache with mod_proxy.
You should think of your webapp as in several seperate layers. where one layer could answering html requests and other serving your static files. always try to find the suitable tool for this mission in terms of speed (and taste). consider serving your static files (those not on CDN) using the fastest web server for static files you can find.
A very important stage is to minify data.
Configure you webserver (nginx, apache,etc) to GZip response.
Set the Vary header (Vary: Accept-Encoding header) correctly for Internet Explorer.
If you have data you can cache in memory for your application server – DO IT.
Use Redis, memcached or any other tool you find is suitable.
It can be small data (like the number of your followers you’ve just counted from facebook, twitter and youtube JSON calls) or the Entire processed HTML.
Put expire time for each resource on your store as needed.
‘ How to speed up website ‘ tutorial ends here.
hope you’ll have fun optimizing your website and now you now few important tips on How to speed up website
Using those steps I’ve managed to reduced my website load time from several seconds to only 1-2 seconds (and sometimes less then second). It’s was worth the effort!!
Good day (or night),
“iptables is a user space application program that allows a system administrator to configure the tables provided by the Linux kernel firewall (implemented as different Netfilter modules) and the chains and rules it stores.
Different kernel modules and programs are currently used for different protocols; iptables applies to IPv4, ip6tables to IPv6, arptables to ARP, and ebtables to Ethernet frames.”
In this tutorial I will give a few essential examples of how to use iptables on CentOS
Continue reading
SSL handshake failed: SSL error: Key usage violation in certificate has been detected.
You may experience the issue if both of the following conditions are met:
GnuTLS library is an open-source alternative to OpenSSL. Most Subversion clients for Windows are built against OpenSSL and are not affected by this issue. While some Subversion packages (available mostly on Linux-based operating systems – The subversion that comes with EL 6 is linked against GnuTLS which is a change from older releases which linked against OpenSSL) are built against GnuTLS and are affected.
The server is using an SSL cert was created with the ‘key usage’ extension, and the client is using the gnutls SSL library which doesn’t understand the extension. The solution is either to have the client use the openssl library or to have the server use a cert that doesn’t use the ‘key usage’ extension.
It’s recommended to fix the issue on your server side, but you can workaround it from the client side too.
Here is what visualsvn.com say:
It’s not recommended to use a self-signed certificate in a production environment. We advise to use a certificate issued by your domain or a third-party certificate authority instead of a self-signed one.
If you have to use a self-signed certificate please follow the instruction to generate a cerificate without specifying ‘Key Usage’ extension:
Add the following registry value to the Windows registry:
for 32-bit system:
[HKEY_LOCAL_MACHINE\SOFTWARE\VisualSVN\VisualSVN Server]
“CreateGnuTLSCompatibleCertificate”=dword:00000001
for 64-bit system:
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VisualSVN\ VisualSVN Server]
“CreateGnuTLSCompatibleCertificate”=dword:00000001
Start VisualSVN Server Manager.
Go to Action | Properties | Certificate.
Click Change certificate… and follow the wizard instructions to generate a new self-signed certificate.
The certificate will be generated without the ‘Key Usage’ extension and will be compatible both with GnuTLS and OpenSSL.
The options for client side fix are:
That’s it.
Good SEO tips for your website / blog / posts / etc.
The first thing you should do BEFORE writing your post is to choose a Focus Keyword.
For example: The focus keyword of this post is “Good SEO“.
You can visit google and start typing “Good SEO” and you’ll see using the auto completion tool that this keyword search is the most common Keyword.
Note: you can actually use other then the most common keyword (in our example, we could use the “Good SEO Tips” keyword, and It could be a great keyword too. It depends on you to choose what you think would fit best your post and is more related to the content of your post.
I could use also “Best SEO” keyword but as you can see below, is not so common used keyword:
REMEMBER the keyword as you will need to use it in page title/url/content/etc.
Now you can start working on your article. Make sure you following:
In our example with the keyword “Good SEO“… our heading is:
“Good SEO tips – Search engine optimization for your blog posts“
If you used title longer then 70 characters in your CMS (Like WordPress Page Title) use the HTML <title></title> to set a maximum of 70 chars title to your page.
this page title is:
<title>Good SEO tips – Search engine optimization for your blog posts</title>
for example: this page URL is:
https://itekblog.com/good-seo-tips
<meta name=”description” content=”Good SEO: what is the best description for my post with the keyword inside?.”/> |
This article Meta is:
First thing you should do BEFORE writing your post is to think of a good SEO plan. good SEO will help your copy to reach more visitors from search engines!.
Which is exactly 156 chars!.
Support Twitter too!! Using:
<meta name=”twitter:card” content=”summary”/>
<meta name=”twitter:site” content=”@ITekBlog”/>
<meta name=”twitter:domain” content=”ITek Blog”/>
<meta name=”twitter:creator” content=”@ITekBlog”/>
<meta name=”twitter:image:src” content=”https://itekblog.com/wp-content/uploads/2013/11/googlelogo-300×146.png”/>
<meta name=”twitter:image:src” content=”https://itekblog.com/wp-content/uploads/2013/11/goodseosearch.png”/>
<meta name=”twitter:image:src” content=”https://itekblog.com/wp-content/uploads/2013/11/bestseosearch.png”/>
<meta name=”twitter:description” content=”First thing you should do BEFORE writing your post is to think of a good SEO plan. good SEO will help your copy to reach more visitors from search engines!.”/>
<meta name=”twitter:title” content=”Good SEO tips – Search engine optimization for your blog posts”/>
<meta name=”twitter:url” content=”https://itekblog.com/good-seo-tips/”/>
Add link to your Google+ page. If authenticated right you will have your image near google searches.
<link rel=”author” href=”https://plus.google.com/109370438350838521961/“/>
If you use WordPress: “WordPress SEO by Yoast” will help you do the job right!