Tuesday, June 9, 2015

Mystory - I attended Twitter's flock 2015

I knew the event on Twitter.
I had wanted to attend it. but I was always wondering "it is OK on work time?"
I tried to decide by myself for having good things.
If I were a CEO, I would recommend employees to attend events they like.

I met an engineer, he was who I had met before in an event of Ride the Lightning.
It was a great time to learn about Fabric.
https://get.fabric.io/

Wednesday, June 3, 2015

Vim - How to turning off indent when pasting text into vim.

■ Sometime, I need to copy and paste text on Vim.
    But It doesn't work like this.
test
   test
      test

■■ This is the solution. ■■

■ Turning off indent
:set paste

■ Do copy

■ Turning on indent
:set nopaste

Monday, May 25, 2015

Nagios - How to install Nagios on Centos

■ Install the libraries
$ yum install gd gd-devel gcc glibc glibc-common
Transaction Summary
=============================================================================================================================
Install      34 Package(s)
Upgrade       3 Package(s)

Total size: 44 M
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
 Package: centos-release-6-5.el6.centos.11.1.x86_64 (@CentOS6-Base/$releasever)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug

■ There is no epel in the yum, so install the following manually
$ wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh epel-release-6-8.noarch.rpm

■ Now list out the installed repositories
$ yum repolist

■ Install the packages bugzilla. (personally, I need to check that why)
$ yum install bugzilla

■ Install Nagios
$ yum install nagios*


■ 1. Set user name in the system environment
export REMOTE_USER=nagiosadmin

■ 2. - Disable notifications for a host
export QUERY_STRING='cmd_typ=25&cmd_mod=2&host=localhost'

■ 3. - Enable notifications for a host
export QUERY_STRING='cmd_typ=24&cmd_mod=2&host=localhost'

■ 4. Execute
/usr/lib64/nagios/cgi-bin/cmd.cgi

■ Reference
http://www.unixmen.com/install-and-configure-nagios-in-centos-6-4-rhel-6-4/
http://lesstif.com/pages/viewpage.action?pageId=6979743

Monday, April 27, 2015

Linux - You may get the following warning message when you login in Linux.


PC-4096:~ A11260$ ssh userId@172.xxx.xxx.1
Last login: Wed Apr 22 05:12:38 2015 from 172.17.90.xx
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

■ The following check box should be not checked.
 @ A selected data might be garbled in your Mysql.

Thursday, April 16, 2015

Gradle - Quick start web - new!

@ This is new version
@ If you want to develop your project in localhost,
     I recommend JettyRun in Gradle.

■ It can make your project deploy automatically.
■  File>New>Project
■  Gradle>Gradle Project


   ■ Project name: gradleJetty
   ■ Sample project: Java Quickstart


■  Open the build.gradle and Add the follew plugins
  (Delete sourceCompatibility = 1.5)
   ->apply plugin: 'war'
     apply plugin: 'jetty'
     sourceCompatibility = '1.7'
     targetCompatibility = '1.7'


■  Make the directory webapp


■  Make the index file index.html


■  Move to the project home
$ gradle jettyRun


■  Can access the follow URL
http://localhost:8080/gradleJetty

■  If you want to change http port, add this into the build.gradle
jettyRun {   httpPort = 9000
  reload = 'automatic'
  scanIntervalSeconds = 2
  // Change http://localhost:9000/gradleJetty for http://localhost:9000 
  contextPath = ''
}

■  You need to change the Classpath compiled like this.

@ Enjoy to develop your project

Nginx - How to install nginx on your mac

■ If brew is not installed in your mac, need to execute the following command.
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

■ how to install nginx on mac 
$ brew install nginx 

■ Start
$ sudo nginx 

■ Stop
$ sudo -s nginx stop

■ Check
http://localhost:8080

■ Just test the configuration file as grammar
$ sudo nginx -t

■ To load config changes, type:
$ sudo nginx -s reload

Tuesday, April 14, 2015

Https - How to generate crt and key files.

@ Change the current directory.
$ cd /usr/local/etc/nginx
$ mkdir ./ssl

@ Generate SSL key, crt files.[openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /usr/local/etc/nginx/ssl/nginx.key -out /usr/local/etc/nginx/ssl/nginx.crt]
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /usr/local/etc/nginx/ssl/nginx.key -out /usr/local/etc/nginx/ssl/nginx.crt
Generating a 2048 bit RSA private key
.........................................+++
..............................................................+++
writing new private key to '/usr/local/etc/nginx/ssl/nginx.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:jp
State or Province Name (full name) [Some-State]:tokyo
Locality Name (eg, city) []:shibuya
Organization Name (eg, company) [Internet Widgits Pty Ltd]:ca
Organizational Unit Name (eg, section) []:test
Common Name (e.g. server FQDN or YOUR name) []:test.io
Email Address []:kim_woongjoon@cyberagent.co.jp

openssl: This is the basic command line tool for creating and managing OpenSSL certificates, keys, and other files.

req: This subcommand specifies that we want to use X.509 certificate signing request (CSR) management. The "X.509" is a public key infrastructure standard that SSL and TLS adheres to for its key and certificate management. We want to create a new X.509 cert, so we are using this subcommand.

-x509: This further modifies the previous subcommand by telling the utility that we want to make a self-signed certificate instead of generating a certificate signing request, as would normally happen.

-nodes: This tells OpenSSL to skip the option to secure our certificate with a passphrase. We need Nginx to be able to read the file, without user intervention, when the server starts up. A passphrase would prevent this from happening because we would have to enter it after every restart.

-days 365: This option sets the length of time that the certificate will be considered valid. We set it for one year here.

-newkey rsa:2048: This specifies that we want to generate a new certificate and a new key at the same time. We did not create the key that is required to sign the certificate in a previous step, so we need to create it along with the certificate. The rsa:2048 portion tells it to make an RSA key that is 2048 bits long.

-keyout: This line tells OpenSSL where to place the generated private key file that we are creating.

-out: This tells OpenSSL where to place the certificate that we are creating.