Category : system
Mac OS setup apache and php
In : system, Posted by admin on Jun.06, 2009
here is the steps to setup apache and php in your Mac OS X.
- Apache and PHP already came with your OS. You just need to enable it.
- Go to the apple icon on the menu bar. Select “System Preferences…” -> “Internet & Network” -> “Sharing”
- Enable “Web Sharing” by click on it
- You just enabled the web server. You can test it by go to: http://localhost/
- To enabled php, in a command window, edit /private/etc/apache2/httpd.conf
- remove the “#” character in front of this line: LoadModule php5_module libexec/apache2/libphp5.so
- restart the apache server by: sudo apachectl restart
- now you have php enabled.
- add a file called: /private/etc/apache2/users/your_username>.conf
- put this in the file:
- #
# Allow access to this user’s Sites directory for web clients.
#
<Directory “/Users/your_username/Sites/”>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>- remember to replace “your_username” with your username.
- restart apache: sudo apachectl restart
- put a file in /Users/your_username/Sites/x.htm
- go to the browser: http://localhost/~your_username/x.htm
- and you will see the file.
How to use ftp in a shell script
In : system, Posted by admin on Mar.03, 2009
First way:
#!/bin/sh HOST='ftp.users.qwest.net' USER='yourid' PASSWD='yourpw' FILE='file.txt' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE quit END_SCRIPT exit 0
Second way:
#!/bin/sh USER=userid PASSWD=userpw ftp -n f2dev <<SCRIPT user $USER $PASSWD binary get some.file quit SCRIPT
HAProxy – a load balancing tool
In : system, Posted by admin on Mar.03, 2009
If you are worry about load balancing. The first thing you should tried is HAProxy.
However, it is not a sure thing. Need some testing on it.
Install Linux From External USB hard drive
In : system, Posted by admin on Mar.03, 2009
After getting that new USB external hard drive case and installing that new hard drive, you need to get it installed and working with your Linux box. These instructions worked for me on Ubuntu and they should work for those with other distributions.
After putting the drive in the case, connecting it to power and plugging it into the back (or front) of your machine, the first thing you need to do is find out what device it is. USB hard drives usually show up as /dev/sdx (where x is a letter starting from a). If this is the only usb drive you have plugged in, it will most likely be /dev/sda.
To find out what it is look at the output of the command: tail /var/log/messages in your terminal. It will give you some irrelevant stuff, so look for a line that looks like this:
May 16 07:50:26 localhost kernel: Attached scsi disk sdb at scsi6, channel 0, id 0, lun 0
On my machine the drive shows up as /dev/sdb because I have an external DVD burner attached.
Now run fdisk as root and create a partition on the drive. On my Ubuntu box I did this by typing: sudo fdisk /dev/sdb into the terminal.
Once in fdisk press p to display a list of current partitions (there shouldn’t be any) and n to create a new partition. You want to create primary partition #1. fdisk will ask a few questions at this point, but since I was setting up an external drive, I didn’t want to create anything fancy so I just created one big partition for the entire drive, the default answers will do this. Once you get back to the fdisk prompt, press w to write the partition table. Now quit fdisk.
Now that you’ve got your partition set up, run the command mkfs.ext3 /dev/sdb1. I ran it as root (using sudo) on my box. This can take a long time, so if you want it to tell you what it’s doing, use the -v option.
Create a mount point
First create a directory you can use as a mount point. Mount point is a directory in the boot partition into which the drive is mounted. Usually the mount points are created under the /mnt/ -directory. Name the directory as you wish to call the new disk.
# mkdir /mnt/newdisk
You may want to issue the chmod go+x /mnt/newdisk command to grant other users access to the mountpoint. Now you may manually mount the drive by issuing command
# mount -t ext3 /dev/hdb1 /mnt/newdisk
Add hard disk to fstab
Mounting the hard drive manually every time is annoying. To mount the disk automatically, add it to fstab -file located in /etc/fstab. Depending on how you named the mount point, add the following lines to the end of /etc/fstab:
/dev/hdb1 /mnt/newdisk ext3 defaults 0 0
The first set is the partition (1st partition of hdb), second describes the mount point and the third describes the filesystem type. ‘defaults’ tells the options. The first 0 is the ‘dump’. It tells the computer whether the drive should be backed up. a ‘0′ means that it will not be backed up, a ‘1′ enables backup. The last number determines the order in which the filesystems should be checked. If it’s zero, ‘fsck’ won’t check the filesystem.
Find all large files on a Linux machine
In : system, Posted by admin on Mar.03, 2009
Finds all files over 20,000KB (roughly 20MB) in size and presents their names and size in a human readable format:
find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
Yum Hangs
In : system, Posted by admin on Mar.03, 2009
Sometime yum takes a long time to finish, it is because there is a lot of old temporary rpm database is created.
To fix the problem, just do the following:
rm -f /var/lib/rpm/__db.*
Adding a second IP address to Fedora Linux
In : linux, system, Posted by admin on Jan.01, 2009
http://www.oclc.org/support/documentation/ezproxy/technote/2l.htm
These are the steps to add the second IP address to your existing network adapter under non-SUSE distributions of Linux.
- Become root on your system, either by logging into that account or using the su command.
- Change your current directory to the /etc/sysconfig/network-scripts directory with the command:
cd /etc/sysconfig/network-scripts - Check for existing network adapters with the command:
ls ifcfg-*In most instances, you will see the files ifcfg-eth0 and ifcfg-lo.
- Edit /etc/hosts and add a line for your new address and name such as:
24.249.162.195 www.xyz.org - To create the new interface, you will copy ifcfg-eth0 to ifcfg-eth0:0 with the command:
cp ifcfg-eth0 ifcfg-eth0:0Next, edit icfg-eth0:0 and change the DEVICE line to be similar to:
DEVICE=eth0:0and change the IPADDR line to be similiar to:
IPADDR=24.249.162.195 - To activate the new IP address, issue a command similar to:
./ifup eth0:0
sendmail 451 Name server timeout
In : linux, system, Posted by admin on Oct.10, 2008
This is something related to sendmail IPv6 support.
- cd /etc/mail
- sendmail.mc and add the following at the end of the file:
- define(`confBIND_OPTS’, `WorkAroundBrokenAAAA’)dnl
- type make
- restart sendmail
hadoop hbase ec2 installation
In : system, Posted by admin on Oct.10, 2008
Here is the steps by steps hbase ec2 installation.
- start elasticfox
- create a “keypairs”
- on your “security groups” default group, add port 50000-51000 (for hadoop) and port 60000-61000 (for hbase)
- search for hbase AMI (ami-4de30724)
- launch the install with the newly create keypair and default group permission
- on you desktop linux/window machine do: ssh -i <keypair.pem> root@<your new instance IP>
- replace the <keypair.pem> with the newly create keypairs pem file
- replace <your new instance IP> to your newly create instance IP address
- step 2 will login your ec2 machine. Then do the following:
- type: ssh-keygen -t dsa -P ” -f ~/.ssh/id_dsa
- type: cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
- type: ssh localhost
- If it does not ask you for the password, you are okay.
- type: exit
- vi /usr/local/hadoop-0.17.1/conf/hadoop-site.xml
- replace: <value>hdfs://:50001</value> to <value>hdfs://INSTANCE IP ADDRESS:50001</value>
- replace: <value>:50002</value> to <value>INSTANCE IP ADDRESS:50002</value>
- type: /usr/local/hadoop-0.17.1/bin/hadoop dfs namenode -format
- type: /usr/local/hadoop-0.17.1/bin/start-all.sh
- check /mnt/hadoop/logs/hadoop-root-namenode-<….>.log and make sure that your hadoop is starting correctly.
- vi /usr/local/hbase-0.2.0/conf/hbase-site.xml
- replace: <value>:60000</value> to <value>INSTANCE IP ADDRESS:60000</value>
- replace: <value>hdfs://:50001/hbase</value> to <value>hdfs://INSTANCE IP ADDRESS:50001/hbase</value>
- type: /usr/local/hbase-0.2.0/bin/start-hbase.sh
- check /mnt/hbase/logs/* to make sure your hbase is start correctly.
- if everything is okay, you can point your browser to: http://INSTANCE IP ADDRESS:60010/ and see the hbase information.
file /etc/avahi/avahi-autoipd.action from install of avahi-autoipd-0.6.22-10.fc9.i386 conflicts with file from package avahi-0.6.17-1.fc7.i386
In : system, Posted by admin on Sep.09, 2008
Today, try to do a “yum update”.
It complains about:
Transaction Check Error:
file /etc/avahi/avahi-autoipd.action from install of avahi-autoipd-0.6.22-10.f
c9.i386 conflicts with file from package avahi-0.6.17-1.fc7.i386
file /usr/sbin/avahi-autoipd from install of avahi-autoipd-0.6.22-10.fc9.i386
conflicts with file from package avahi-0.6.17-1.fc7.i386
file /usr/share/man/man8/avahi-autoipd.8.gz from install of avahi-autoipd-0.6.
22-10.fc9.i386 conflicts with file from package avahi-0.6.17-1.fc7.i386
To fix it, do the following:
su
rpm -e –noscripts avahi-0.6.17-1.fc7.i386
yum update