The Ruby on Rails web application framework got lots of buzz in last year. Apple has just posted very nice and easy to follow tutorial on Ruby On Rails for web development on Mac OS X.
According to apple it is no surprise that Mac OS X is a favored platform for Rails development. Rails and its supporting cast of web servers and databases thrive on the rich Mac OS X environment.
* This tutorial covers
* Installing Rails
* Creating a New Rails Application
* Jump-Starting the Application
* Creating the Database Schema
* And other related stuff etc
Overall an excellent tutorial and highly recommend for all newbie’s out there.
You may use many macros under office packages. However, your ftp client also supports macros. You can use ~/.netrc – user configuration file. The .netrc file contains login and initialization information used by the auto-login process and stores macros information. It resides in the user’s home directory.
Turn on FTP client auto login
You need to add username and password to file ~/.netrc. Open config file using a text editor such as vi:
$ vi ~/.netrc
Append or add following lines to it:
machine ftp.myserver.com login USERNAME password PASSWORD
Save file and exit to shell prompt. Make sure, only owner can read the file:
$ chmod 0600 ~/.netrc
To connect type command:
$ ftp ftp.myserver.com
Now let us say every time you connected to ftp server you would like to switch to binary mode and turn off prompt as well as go to directory /pub/data/backup/rdbms/dump/. You can create a macro to automate all these three steps:
i) Open ~/.netrc ftp configuration file:
$ vi ~/.netrc
ii) Define a macro
You need to use the following syntax:
Please note that each macro definition ends with a null line (consecutive new line characters in a file or carriage returns from the terminal). There is a limit of 16 macros and 4096 total characters in all defined macros. Macros remain defined until a close command is executed.
Append following text to .netrc file:
Save and close the file. Now connect to ftp server:
$ ftp ftp.myserver.com
Connected to ftp.myserver.com
220 ftp.myserver.com NcFTPd Server (licensed copy) ready.
Remote system type is UNIX.
Using binary mode to transfer files.
To execute a macro FOO type the command:
ftp> $ FOO
200 Type okay.
Interactive mode off.
250 "/pub/data/backup/rdbms/dump/" is new cwd.
=> ftp command man page
Almost all Linux distribution comes with its own set of GUI tools to manage users and groups. For example:
* Red Hat comes with redhat-config-user
* Suse comes with Yast
* Debian Linux and other distro come with users-admin GUI tool set
* FreeBSD with sysinstall
* Solaris comes with Solaris Management Centre (SMC)
However, I recommend managing user accounts from command line. It offers following benefits over GUI tools:
- Using commands from command line is faster
- Automation is possible as per your requirements (use of Perl or shell scripting)
- If you are going to use LDAP or NIS then command line provides best solution as compare to GUI tools
The best way to edit /etc/passwd, or shadow or group file is to use vipw command. Traditionally (under UNIX and Linux) if you use vi to edit /etc/passwd file and same time a user try to change a password while root editing file, then the user’s change will not entered into file. To avoid this problem and to put a lock while editing file, use vipw and vigr command which will edit the files /etc/passwd and /etc/group respectively. If you pass -s option to these command, then they will edit the shadow versions of those files i.e. /etc/shadow and /etc/gshadow, respectively.
The main purpose of locks is to prevent file corruption. Do not use vi or other text editor to edit password file. Syntax:
- vipw -s : Edit /etc/passwd file
- vigr -s : Edit /etc/group file
Login as a root user:
# vipw -s
On other terminal login as normal user (for example vivek) and issue command passwd to change vivekâ€™s password:
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token lock busy
As you see it returned with an error “passwd: Authentication token lock busy”
This will avoid /etc/shadow file corruption.
You need to use the sudo command to grant a permission to other users to shutdown your server. The sudo command allows a permitted user to execute a command as the superuser or another user, as specified in the /etc/sudoers file. Login as a root user and type the visudo command to edit the sudoers file.
One of my friend installed Oracle first time. After installation, he just wants to make sure everything is working fine so he called me. If you are installing oracle for Unix/Linux oses first time then it will confuse you. He wanted to know how to start oracle service and test it. He emailed me the following error:
ORA-27101: shared memory realm does not exist
ORA-01034: ORACLE not available
You need to add following line to oracle userâ€™s .bash_profile file for testing purpose (once it is tested, you can give control to Oracle DBA) (login as a oracle user):
$ cd;vi .bash_profile
Append following lines:
Save file. Just load the above settings:
$ . .bash_profile
Start oracle Net listing service:
$ lsnrctl start
ALTERNATIVELY use full path:
$ /home/oracle/oracle/product/10.2.0/db_1/bin/lsnrctl start
Start oracle database:
ALTERNATIVELY, use full path:
Connect to Oracle database with sqlplus client (test it with scott username):
$ sqlplus "scott/tiger"
sql> select * from tab;
To shutdown Oracle database:
$ lsnrctl stop
If you are new to Oracle try out Oracle Database 10g Documentation library, especially 2 Day DBA is fantastic document. Do not forget check out John Smiley’s “Installing Oracle Database 10g Release 2 on Linux x86” article. It will teach you the basics of installing Oracle Database 10g Release 2 on Red Hat Enterprise Linux or Novell SUSE Enterprise Linux, from the bare metal up.
If you have, a password protected grub boot loader and you forgot both root and grub password, then you can recover grub-boot loader password using the following method/procedure:
* Use Knoppix cd
* Remove the password from Grub configuration file
* Reboot the system
* Change the root password
* Setup new Grub password if required (optional)
VMware Workstation allows the creation and execution of multiple x86 virtual computers simultaneously. Setting up VMWARE workstation host computer can be tricky. Official VMWARE workstation document recommend of creating vmnet1 and vmnet2. However, you can use eth0 and vmnet1 to route all traffic from guest operating systems via Linux host. This is quite useful:
* If you don’t want setup firewall for each operating system inside VMWARE
* Ease of IP accounting etc
VMWARE Workstation Running on P4 system with 4 GB RAM
OS: Red Hat Enterprise Linux 4.0
- eth0: 192.168.1.1
- vmnet1: 192.168.2.1 (hostonly networking)
Step # 1: Stop vmware and service
Shutdown all VMâ€™s and stop vmware service:
# /etc/init.d/vmware stop
Force Linux to act as a router:
echo 1 > /proc/sys/net/ipv4/ip_forward
Open /etc/sysctl.conf file and
# vi /etc/sysctl.conf
Make sure IP packet forwarding is set:
net.ipv4.ip_forward = 1
Save and close the file. Above line ensures that Linux as a router after rebooting system.
Step # 2: Configure hostonly networking
You need to configure interfaces on Linux Vmware host:
- eth0 (Bridge) : Static IP 192.168.1.1
- vmnet1 (hostonly) : Static IP 192.168.2.1
Type following command to configure vmware:
At networking screen, add hostonly networking for vmnet1 Keep eth0 (bridge) as it is. Assign IP 192.168.2.1 to vmnet1.
Step # 3: Configure Linux Host to route traffic
Just add following IPtables rules to your iptables script so that you can route traffic between eth0 (Linux host) and vmnet1 (Guest OS):
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface vmnet1 -j ACCEPT
iptables -A INPUT -i vmnet1 -s 192.168.2.0/24 -d 192.168.1.1 -j ACCEPT
Step # 4 Configure Guest OS
- Start Vmware application.
- Select Virtual machine
- Click on VM
- Select Settings
- Select Ethernet1
- Select Network Connection: â€œHost-only: A private network shared with the hostâ€
- Click ok to save
Power on virtual system and point router IP address to 192.168.2.1, here is sample FreeBSD rc.conf file:
defaultrouter="192.168.2.1"Please note that you need to add appropriate iptables rules to allow incoming traffic to Guest os. Just add your rules to Linux host.
ifconfig_lnc0="inet 192.168.2.5 netmask 255.255.255.0"
This is one of main responsibilities of a system administrator. It is his/her job to safeguard data stored on the system. Data is lost by (according to IBM white paper):
- Hardware or System Malfunction (44%) such as Hardware equipment failures
- Human Error (32%) such as Accidental removal of files
- Software Malfunction (14%) such as Software failures or crash or File system corruption
- Viruses (7%)
- Natural Disasters (3%) such as Fire
- Others such as Crackers/Hackers, Unskilled employees or Dissatisfied employees
How much data can you afford to lose?
The cost of recovering data and time both are very high for example:
To recover sales and marketing data 50M data it could take 15+ business days and cost running over USD $15,000+.
Therefore, to minimize the chance of data loss you should do regular backups: Regular backups result into:
- Minimize data loss
- Keep your users happy
The exact backup procedure is different for each organization; it depends upon factors such as:
- Number of users
- Amount of activity
RT Essentials and The Definitive “I work with a guy named Todd who suggested our department start using RT. We were already using a simple ticketing system and no one really saw a need to replace it. Even so, he kept pushing and set up his own RT server. Finally, everyone agreed to try it out. It was clumsy at first, but after a week or so, I started to get the hang of it. Six months later, I think RT is one of the best tools I\u2019ve used in my career…” Read complete review online.
The Definitive Guide to Apache mod_rewrite “The wonderful folks over at Apress sent me a preview copy of The Definitive Guide to Apache mod_rewrite. Before reading this book, I knew the very basics about mod_rewrite and only used it once or twice to mangle a URL. However, after reading, I’m amazed at everything this single module can accomplish….” Read complete review online.