Thursday, December 11, 2014

SSH

$ ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
Enter file in which to save the key (/home/you/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

Embedding password into key file
$ openssl rsa < id_rsa > id_rsa_withpass
Enter pass phrase:************
writing RSA key

useradd tai
passwd -u -f tai
usermod -g wheel tai
mkdir /home/tai/.ssh
mv authorized_keys /home/tai/.ssh/
chown tai:tai /home/tai/.ssh
chown tai:tai /home/tai/.ssh/authorized_keys
chmod 700 /home/tai/.ssh
chmod 600 /home/tai/.ssh/authorized_keys
sudo visudo

Tuesday, September 30, 2014

Virtualhost for Apache 2.4

VirtualHost *:80>
        DocumentRoot /your_path
        ServerName domain.local.com
        # ErrorLog /var/log/apache2/error.log
        <Directory /your_path>
                Options All +Indexes +FollowSymLinks
                 AllowOverride All
                 Order allow,deny
                 Allow from all
                 Require local
        </Directory>
</VirtualHost>

Sunday, July 13, 2014

Install Apache + PHP + Mysql

Update your respository before installing these
$ sudo apt-get update

Install Apache
$ sudo apt-get install apache2

Install PHP
$ sudo apt-get install php5

Install Apache
$ sudo apt-get install mysql-server

Install phpmyadmin
$ sudo apt-get install phpmyadmin

Wednesday, May 7, 2014

Basic GIT commands

clone a new project from a repository on Server
$ git clone //server_path

Show the information on repository in local
$ git remote show origin

Show the branch information
$ git branch

Show list of the configuration
$ git config -l

Switch to a branch
$ git checkout <branch_name>

Push to another branch on Server
$ git push origin local_branch:server_branch

Update latest commit
$ git pull

Edit latest comment
$ git commit --amend -m "New commit message"

Show all version
$ git log

Show current version
$ git show

Delete latest commit
$ git reset --soft 'HEAD^'

Revert latest commit
$ git reset --hard HEAD

Fix error "The following untracked working tree files would be overwritten by merge"
Use -n or --dry-run to preview the damage you'll do.
$ git clean -n
$ git clear -n <file_path> To create a "feature branch" from the dev branch $ git checkout -b myfeature dev Delete a branch $ git branch -d myfeature

Wednesday, January 1, 2014

How to: Ruby on Rails + Ubuntu + Apache with Passenger

Now you can use gem to install Rails:

sudo gem install rails


Install Phusion Passenger (an Apache module that lets you run Rails apps easily):

sudo gem install passenger

sudo passenger-install-apache2-module


The passenger-install-apache2-module script will guide you through what you need to do to get Passenger working. It should tell you to copy these lines into your /etc/apache2/apache2.conf:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so

PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2

PassengerRuby /usr/bin/ruby1.8


Create a file in /etc/apache2/sites-available/ for your site (something like 'irorio.local.jp') and insert this:
<VirtualHost *:80>
        alias /iapps /home/taind/svn/branch/irorio/irorio-api/public
        ServerName irorio.local.jp
        DocumentRoot /home/taind/svn/branch/irorio/irorio
        DirectoryIndex index.php
        SetEnv APPLICATION_ENV development
        <Directory /home/taind/svn/branch/irorio/irori>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        <Location /iapps>
                PassengerBaseURI /iapps
                PassengerAppRoot /home/taind/svn/branch/irorio/irorio-api
        </Location>
        <Directory /home/taind/svn/branch/irorio/irorio-api/public>
                Options -MultiViews
                Allow from all
        </Directory>
        RailsEnv development
        #RailsBaseURI /iapps
</VirtualHost>