Thursday, December 25, 2008
Watch Youtube Video on Centos 5
flash-plugin-10.0.15.3-release.i386.rpm
from adobe website.
Install:
rpm -Uvh flash-plugin-10.0.15.3-release.i386.rpm
Close all firefox windows.
Restart firefox, you should be able to watch the video on youtube website.
Wednesday, December 24, 2008
Static IP configuration on Ubuntu 8.10ic
sudo gedit /etc/network/interfaces
add lines:
auto eth0
iface eth0 inet static
address 192.168.0.108
netmask 255.255.255.0
gateway 192.168.0.1
If there is a line like:
iface eth0 inet dhcp
need to add # before the line to comment it.
2. Edit file /etc/resolv.conf
sudo gedit /etc/resolv.conf
Add lines:
search 64.59.144.93
nameserver 64.59.144.92
These are DNS, that might be different for different ISP
If you do only step 1, not step 2, you can only visite web site by using number IP not domain name.
3. Restart network
sudo /etc/init.d/networking restart
You should see the static IP you setup.
Note: the graphic thing (for net work configure) on the top bar is not working even I set up everything there.
Install Eclipse 3.4 (jee) in Ubuntu 8.10
Java - Application--Add/Remove -- Programming to get the latest version, as the time this is written, the version is 1.6
There are many articles about the java installation.
Eclipse - Eclipse website -eclipse-jee-ganymede-SR1-linux-gtk.tar.gz
I download this one is because no plugin is required to run with Apache-tomcat
Tomcat -- apache website - the version i got is apache-tomcat-6.0.18.tar.gz
Install packages
Sun's Java JDK: Many ways to do this. there are many different way on the website. I will put one here later.
Tomcat:
tar xzf apache-tomcat-6.0.18.tar.gz
sudo mv apache-tomcat-6.0.18 /usr/local
cd /usr/local
sudo chown -R root:root apache-tomcat-6.0.18
sudo chmod -R +r apache-tomcat-6.0.18
sudo chmod +x `sudo find apache-tomcat-6.0.18 -type d`
sudo ln -s apache-tomcat-6.0.18 tomcat
Edit tomcat users:
sudo gedit /usr/local/tomcat/conf/tomcat-users.xml
And add an admin and your username and password:
user name="admin" password="admin" roles="manager,admin"
user name="yourname" password="blah" roles="manager,admin"
Eclipse:user name="yourname" password="blah" roles="manager,admin"
Extract the eclipse download and move to opt.
tar zxvf eclipse-jee-ganymede-SR1-linux-gtk.tar.gz
sudo mv eclipse /opt/eclipse
cd /opt
sudo chown -R root:root eclipse
sudo chmod -R +r eclipse
sudo chmod +x `sudo find eclipse -type d`
Then create an eclipse executable in your path
sudo touch /usr/bin/eclipse
sudo chmod 755 /usr/bin/eclipse
sudo gedit /usr/bin/eclipse
With this contents
#!/bin/sh
#export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
export ECLIPSE_HOME="/opt/eclipse"
$ECLIPSE_HOME/eclipse $*
Then create a gnome menu item
sudoedit /usr/share/applications/eclipse.desktop
With this contents
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true
Configure
You now have a working eclipse.
But run this command first to initialise the set up.
/opt/eclipse/eclipse -clean
Then from here on you can run from the menu item
applications/programming/eclipse
Eclipse 3.4 (Ganymede) on Ubuntu
JDK
Make sure that it is at least Java 5.
sudo apt-get install openjdk-6-jdk
Then update your ~./bashrc file, appending the JAVA_HOME (adjust this if you use a different JDK).
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
Get Ganymede
wget http://ftp.osuosl.org/pub/eclipse/technology/epp/downloads/release/ganymede/R/eclipse-java-ganymede-linux-gtk.tar.gz
tar xzvf eclipse-java-ganymede-linux-gtk.tar.gz
mv eclipse eclipse3.4
We should be ready to go:
eclipse3.4/eclipseAnd your nice new Eclipse is up and running.
Suggested Plugins
Eclipse is great because it has so many plugins. I even use it as my default Python editor. If you go to Help > Software Updates, you will see a vastly improved update dialog (the previous one was painful).
- EclEmma is a great code coverage tool. Update site: http://update.eclemma.org/
- Subclipse is the best Subversion plugin I have come across. Update site: http://subclipse.tigris.org/update_1.2.x
- PyDev one of the best editors I have come across (Code completition, refactoring, etc.). Update site: http://pydev.sourceforge.net/updates/
- Mecrurial My favorite new DVCS tool inside Eclipse. Update site: http://www.vectrace.com/eclipse-update/
- Regular Expressions can be easily tested with this plugin. Update site: http://brosinski.com/regex/update/
- Maven the Ant-replacement build tool for Java. Update site: http://m2eclipse.sonatype.org/update/
Update: As Scott points out in the comments, there is an open request on launchpad to include a more recent version of Eclipse in the Ubuntu repositories: https://bugs.edge.launchpad.net/ubuntu/+source/eclipse/+bug/123064
Tuesday, December 23, 2008
Install MySQL 5.0.67 on Ubuntu 8.10
下面是在Ubuntu 8.10下完成安装的MySQL,MySQL 服务器应该自动启动。您可以在终端提示符后运行以下命令来检查 MySQL 服务器是否正在运行:(见图1)
sudo netstat -tap | grep mysql
当您运行该命令时,您可以看到类似下面的行:
linuxidc@linuxidc-laptop:~$ sudo netstat -tap | grep mysql
[sudo] password for linuxidc:
tcp 0 0 localhost:mysql *:* LISTEN 7283/mysqld
linuxidc@linuxidc-laptop:~$
要在Ubuntu 8.10下安装 MySQL,我们可以在终端命令行下输入下列命令:(如图2)
sudo apt-get install mysql-server mysql-client
linuxidc@linuxidc-laptop:~$ sudo apt-get install mysql-server mysql-client
[sudo] password for linuxidc:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会安装下列额外的软件包:
libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl
mysql-client-5.0 mysql-server-5.0
建议安装的软件包:
dbishell mysql-doc-5.0 tinyca
下列【新】软件包将被安装:
libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl mysql-client
mysql-client-5.0 mysql-server mysql-server-5.0
共升级了 0 个软件包,新安装了 8 个软件包,要卸载 0 个软件包,有 0 个软件未被升级。
需要下载 35.8MB 的软件包。
解压缩后会消耗掉 109MB 的额外空间。
您希望继续执行吗?[Y/n]
当然选择Y了,在安装过程中会有软件包设置,输入root密码及再次确认。然后确定(见图3)。
如果服务器不能正常运行,您可以通过下列命令启动它:
sudo /etc/init.d/mysql restart
* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.
配置 MySQL 的管理员密码
sudo mysqladmin -u root password newpassword
配置MySQL
注意,MySQL缺省是只允许本地访问的,如果你要其他机器也能够访问的话,那么需要改变/etc/mysql/my.cnf配置文件了!
默认的MySQL安装之后根用户是没有密码的,所以首先用根用户进入:
$mysql -u root
在这里之所以用-u root是因为我现在是一般用户(firehare),如果不加-u root的话,mysql会以为是firehare在登录。注意,我在这里没有进入根用户模式,因为没必要。一般来说,对mysql中的数据库进行操作, 根本没必要进入根用户模式,只有在设置时才有这种可能。
如果你是用的root用户进入时则可以不要切换用户,直接进入第三步
进入mysql之后,最要紧的就是要设置Mysql中的root用户密码了,否则,Mysql服务无安全可言了。
mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "123456";
注意,我这儿用的是123456做为root用户的密码
用root用户建立你所需要的数据库。我这里就以xoops为例:
mysql>CREATE DATABASE xoops;mysql>GRANT ALL PRIVILEGES ON xoops.* TO xoops_root@localhost IDENTIFIED BY "654321";
这样就建立了一个xoops_roots的用户,它对数据库xoops有着全部权限。以后就用xoops_root来对xoops数据库进行管理,而无需要再用root用户了,而该用户的权限也只被限定在xoops数据库中。
如果你想进行远程访问或控制,那么你要做两件事:
其一:
mysql>GRANT ALL PRIVILEGES ON xoops.* TO xoops_root@"%" IDENTIFIED BY "654321";
允许xoops_root用户可以从任意机器上登入MySQL。
测试通过了,可是不知道为什么在访问的速度上很慢,可能是UBUTN的内存只有100M的原因,哈哈!!!!
$sudo gedit /etc/mysql/my.cnf
老的版本中
>skip-networking => # skip-networking
新的版本中
>bind-address=127.0.0.1 => bind-address= 你机器的IP
这样就可以允许其他机器访问MySQL了。
DESTOP版下安装MYSQLCC
apt-get install mysqlcc
gedit /usr/share/applications/MySQLCC.desktop
Insert the following lines into the new file
将下列语句插入新文件
[Desktop Entry]
Name=MySQLCC
Comment=MySQLCC
Exec=mysqlcc
Icon=/usr/share/pixmaps/mysqlcc.xpm
Terminal=false
Type=Application
Categories=Application;System;
这样就可以使用MYSQLCC来操作数据库了。
Install MySQL 5.0.51b on Ubuntu 8.10
While install MySQL 5.0.51b for Linux on Ubuntu 8.10
when I execte configure:
sudo ./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --sysconfdir=/etc
got error message:
checking for tgetent in -ltermcap... no
checking for termcap functions library... configure: error: No curses/termcap library found
Solution
need to install ncurses-5.2.tar.gz,after install, set the path in the configure parameter
or maybe the ncurses is already installed, so just add path.
add
--with-named-curses-libs=/usr/lib/libncursesw.so.5
the it looks like this:
sudo ./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --sysconfdir=/etc --with-named-curses-libs=/usr/lib/libncursesw.so.5
Install Apach Tomcat 6 on Ubuntu 8.10
Before we install Tomcat we need to find out if we already have installed Java. Let’s assume that we are trying to install Tomcat we’ve already installed java, but if we aren’t sure we can check with the dpkg command like this:
dpkg –get-selections | grep sun-java
This should give us this output if we already installed java:
sun-java6-bin install
sun-java6-jdk install
sun-java6-jre install
If that command has no results, we’ll want to install the latest version with this command:
sudo apt-get install sun-java6-jdk
Installation
Now we’ll download and extract Tomcat from the apache site. We should check to make sure there’s not another version and adjust accordingly.
wget http://apache.hoxt.com/tomcat/tomcat-6/v6.0.14/bin/apache-tomcat-6.0.14.tar.gz
tar xvzf apache-tomcat-6.0.14.tar.gz
The best thing to do is move the tomcat folder to a permanent location. I chose /usr/local/tomcat.
sudo mv apache-tomcat-6.0.14 /usr/local/tomcat
Tomcat requires setting the JAVA_HOME variable. The best way to do this is to set it in the .bashrc file.
The better method is editing the .bashrc file and adding the bolded line there. We’ll have to logout of the shell for the change to take effect.
vi ~/.bashrc
Add the following line:
export JAVA_HOME=/usr/lib/jvm/java-6-sun
At this point we can start tomcat by just executing the startup.sh script in the tomcat/bin folder.
Automatic Starting
To make tomcat automatically start when we boot up the computer, we can add a script to make it auto-start and shutdown.
sudo vi /etc/init.d/tomcat
Now paste in the following:
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pidexport JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0
We’ll need to make the script executable by running the chmod command:
sudo chmod 755 /etc/init.d/tomcat
The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.
sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
Tomcat should now be fully installed and operational. Cheers!