Zhixian's Tech Blog

2015-10-30

Installing Alpine

Filed under: Uncategorized — Zhixian @ 23:08:10 pm

I do not find the default “mail” program in Linux is not user-friendly.

Hence, I would suggest another console e-mail application.
Two applications come to mind, pine and elm.
I’m picking pine as I have slightly more familiarity with it and I think it is more user-friendly than elm.

Pine is a proprietary application owned by University of Washington. So I am picking to install the open-source version of this application call Alpine. To install Alpine type the following command:

$ sudo apt-get install alpine

After the installation has complete, type the following command to run it:

$ alpine

Changing Screen Resolution of Ubuntu on VirtualBox

Filed under: Uncategorized — Zhixian @ 23:08:10 pm

Identify the resolution that your VirtualBox environment supports.

Reboot the system and hit ‘c’ when the grub windows appears appears to access grub console. In grub console, enter the following command to see a list of resolutions (eg, 1024x768x32):

grub> vbeinfo

Edit the grub configuration file
/etc/default/grub. Uncomment the following line in the file.

GRUB_GFXMODE=1152x864x32

Replace the resolution with the one appropriate for your environment.

Save the file. Then update your grub configuration by running:

$ update-grub

Restart your virtual machine again

Reference

http://askubuntu.com/questions/456527/maximum-terminal-resolution-in-ubuntu-server-virtual-box-guest

hellorails

Filed under: Uncategorized — Zhixian @ 23:06:10 pm

This blog is about creating a first Rails web application.
Before proceeding, you need to install sqlite.

Summary of Steps

  1. Install sqlite
  2. Install nodejs
  3. Create hellorails
  4. Running hellorails

Install sqlite

To install sqlite, run the follow commands:

$ sudo apt-get install sqlite3
$ sudo apt-get install libsqlite3-dev

Note: We have to install libsqlite3-dev because we want to use add sqlite support to Rails via gem.

After sqlite is installed, we can add sqlite support to Rails by running the following command.

$ sudo gem install sqlite3 -v '1.3.11'

Install nodejs

Rails do not a built-in web server. It relies on other infrastructure to run. Here, I decide to install nodejs as I am intending to do some other nodejs development later on as well.

$ sudo apt-get install nodejs
$ sudo apt-get install npm

Creating hellorails

After all the setup is done, we can start to create our hellorails application by running the following command:

sudo rails new ./hellorails

Running hellorails

After the application is created, navigate into the directory.
You can run the application by running the following command:

$ rails server

Note: This command will start a web server listening on localhost on port 3000. What this means, is that you can only access the web application on your local machine. To allow other machines to access the web application on port 3000, you need to make the web server listen to the IP address of 0.0.0.0. This can be done by running:

$ rails server -b 0.0.0.0

An alternative to adding the parameter is edit boot.rb file in the config folder.

Reference

http://guides.rubyonrails.org/initialization.html

Installing Ruby

Filed under: Uncategorized — Zhixian @ 23:06:10 pm

Installation

$ sudo apt-get install ruby-full

This will install Ruby 1.9.3 as of this writing.

I want to do Ruby on Rails, I need to install Rails.
Rails however require “make” which is not installed out of the box.
So we need to install that first.

$ sudo apt-get install make

Apparently, it also require zlib development libraries.
You need to install it by running the following command:

$ sudo apt-get install zlib1g-dev

Before installing Rails, you may want to install the “rdoc” package.
If not, you may encounter the error message “file ‘lib’ not found”.

$ sudo gem install rdoc

After installation of “rdoc” package, you can install Rails using:

$ sudo gem install -V rails

Note: The “-V” parameter in the above command makes the installation process more verbose and may be omitted. If omitted, it may appear as if the process is hanged as there is not visible feedback on the installation process. The download and installation process itself takes quite a while.

Alternatively, you may want to run the following command to install Rails instead. This command will not install documentation for Rails which can take some time to generate (and hence misled you to think that the process has hanged).

$ gem install rails --no-ri --no-rdoc

Reference

https://help.ubuntu.com/community/RubyOnRails

Installing FTP server

Filed under: Uncategorized — Zhixian @ 23:05:10 pm

Installation

$ sudo apt-get install vsftpd

Configuration

Edit the configuration file /etc/vsftpd.conf

Uncomment this line to allow users to be able to upload files:

write_enable=YES

Uncomment this line to limited to their home directories:

chroot_local_user=YES

Add the following line to counter the message:
500 OOPS: vsftpd: refusing to run with writable root inside chroot()

allow_writeable_chroot=YES

Restart server

$ sudo restart vsftpd

Reference

https://help.ubuntu.com/lts/serverguide/ftp-server.html

https://www.benscobie.com/fixing-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot/#comment-2051

Installing Git

Filed under: Uncategorized — Zhixian @ 23:00:10 pm

Installation

$ sudo apt-get install git

Basic Setup

$ git config --global user.email "you@example.com"
$ git config --global user.name "Your Name"

Reference(s)

https://help.ubuntu.com/lts/serverguide/git.html

2015-10-23

Setup Ubuntu (Trusty Tahr) for development

Filed under: development, ubuntu — Tags: , , , , — Zhixian @ 11:18:10 am

This blog post is on my setting up another Ubuntu Server VM.
This time I want a VM that has the common software development applications pre-installed.
As such most of the steps are similar to what I did in a previous blog post.
So on this blog post, I will start from the screen where I can select pre-packaged software.

image

Although, I was not really sure I really need the DNS server and print server, I thought “Ah well. Might as well.”
So they are included.

Setup MySql

First thing to setup is to assign a password for MySql server “root” account.
Note: You may have notice that background color have changed from purple to blue.
This was because I typed the wrong confirmation password when setting the password.

image

 

image

Setup E-mail

 

image

 

image

 

image

 

image

2015-10-15

Connecting to OpenSSH server using MobaXterm

Filed under: computing, ubuntu — Tags: , , , , , — Zhixian @ 14:19:10 pm

This blog post covers connecting to the openssh server installed on Ubuntu server using MobaXterm.

Testing OpenSSH

I want to connect to the openssh server.
For this purpose, I use MobaXterm from Mobatek (http://mobaxterm.mobatek.net/).
This is a terminal application with a few other tools built-in.
It has a professional edition which cost money and a home edition that is free.
For our local development purpose, the free edition is fine.

Alternatively, there’s the putty-series (http://www.putty.org/) of applications.

The remainder of this session assumes you are using MobaXterm.

After you start up MobaXterm, you may see a window like the below.
Click on the Session button on the menu.
This will open the Session Settings dialog.

image

On the Session Settings dialog, click on the SSH button on the top menu.

image

Under the Basic SSH settings tab, enter the name of the remote host.
Click the OK button to connect to the server.

image

After you clicked OK, MobaXterm will start your session on a new tab.
You should see your usual login prompt.
You should be able to login to your account as usual.

image

File transfer using SFTP

You can transfer files from your Windows machine to your Ubuntu machine using SFTP (Secure-FTP).
One the tools built-in the MobaXterm client is a SFTP client.
Click on the SFTP tab to display the directory and files in the directory.

image

To transfer files, simple drag and drop the files that you want to transfer in the area showing files in specified directory.

Ubuntu Server Initial Setup

Filed under: computing, ubuntu — Tags: , , , , , — Zhixian @ 13:29:10 pm

After you have installed your Ubuntu server, you may want to do some initial setup.
Specifically, you may want to add a another account.

Adding user account

Adding users can be done using the command adduser. In the below command-line, I am creating a developer account call ‘developer’.

$ sudo adduser developer

image

After you have create the user account, it might be useful to add the account to the ‘sudo’ group so that the account can make use of the ‘sudo’ command. To do so,

$ sudo addgroup developer sudo

image

You can check which groups an account belongs to using the ‘groups’ command:

$ groups developer

image

2015-10-11

Setting up Ubuntu 14.04 Server on VirtualBox

Filed under: computing, ubuntu — Tags: , , , , — Zhixian @ 17:15:10 pm

This is a blog post that describes my setup of Ubuntu Server 14.04 (Trusty Tahr) on VirtualBox.
I intended to use this server for local software development.

Selected Software Package Description
OpenSSH server Needed for remote secure shell sessions
LAMP Linux Apache MySql PHP development stack
PostgreSQL database Best open-source database
Samba file server File sharing
Skipped Software Packages Description
DNS server Don’t really think I need it
Mail server I will describe this in a later blog post
Print server Don’t really think I need it
Tomcat Java Server Not sure if I want to use this;

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

 

image

Blog at WordPress.com.