2012年11月30日星期五

Ubuntu下安装tomcat 6


Ubuntu下安装tomcat 6  

2011-04-04 09:24:14|  分类: WEB技术|字号 订阅
Tomcat设置JSP开发环境,有两种,或是用源安装,或是自己下载配置 Tomcat,推荐后者。

源方式(不推荐)

安装Tomcat
Tomcat是由Apache Foundation研发用于支持JSP(Java Server Page)的网络服务软件。
sudo apt-get install tomcat6 
稍等片刻,Tomcat6 即会被自动安装在/usr/share/tomcat6的目录中

设置Tomcat运行的JAVA环境

首先请确保Sun的Java Development Toolkit已经安装。如果尚未安装,参照Java

启动和停止Tomcat

要启动Tomcat,运行
qii@ubuntu:~$ sudo /etc/init.d/tomcat6 start
 * Starting Tomcat servlet engine tomcat6                                               [ OK ] 
此时打开浏览器,在地址栏内输入http://localhost:8080

要停止Tomcat,运行
qii@ubuntu:~$ sudo /etc/init.d/tomcat6 stop
 * Stopping Tomcat servlet engine tomcat6                                               [ OK ] 

Tomcat 配置文件路径

Tomcat home directory : /usr/share/tomcat6
Tomcat base directory : /var/lib/tomcat6
要停止Tomcat,运行
qii@ubuntu:~$ sudo /etc/init.d/tomcat6 stop * Stopping Tomcat servlet engine tomcat6 [ OK ]

Tomcat 配置文件路径

Tomcat home directory : /usr/share/tomcat6 Tomcat base directory : /var/lib/tomcat6

设置Tomcat管理员帐号

Tomcat的用户帐号信息都保存在tomcat-users.xml的文件中,运行
sudo nano /var/lib/tomcat6/conf/tomcat-users.xml
在</tomcat-users>的标签前添加一行
<user username="用户名" password="密码" roles="admin,manager"/>
保存并关闭。重新运行tomcat即可输入该用户名和密码,登录Tomcat的管理页面。

弊端

Ubuntu 默认把 Tomcat 分到2个目录,在之后配置 Eclipse Server 时会把人逼疯的,配置哪个路径都不对,Eclipse 无法识别安装的 Tomcat。 解决方案: sudo ln -s /var/lib/tomcat6/conf /usr/share/tomcat6/conf sudo ln -s /etc/tomcat6/policy.d/03catalina.policy /usr/share/tomcat6/conf/catalina.policy sudo ln -s /var/log/tomcat6 /usr/share/tomcat6/log sudo chmod -R 777 /usr/share/tomcat6/conf 

下载安装最新版本的Tomcat

这种方法绕过 Ubuntu 自身的包管理器,直接从Apache Tomcat的主页上下载并使用Tomcat软件,该方法方便快捷的安装旧版或新测试版 Tomcat 而并不影响系统的稳定性,轻松自在。
从tomcat的官方下载页面
http://tomcat.apache.org/download-70.cgi
下载Binary->Core分类中的zip或者tar.gz包后,本地解压缩并将新生成的目录重命名为tomcat,以方便使用。将这个文件夹移动至某路径PATH/。 参考以上设置环境变量和端口设置等步骤,大功告成! 直接运行
PATH/tomcat/bin/./startup.sh
Tomcat 便即刻在后台服务了。 (请将PATH替换成适合您的路径) 

配置开发环境

Eclipse

以下载的 Eclipse for Java EE 为例,右击底部面板分页 Servers - New - Server,选择你要的 Tomcat 版本,添加进路径。 
Ubuntu下安装tomcat 6 - philn - IT基础知识
 
Preferences - Server - Runtime Environments
Ubuntu下安装tomcat 6 - philn - IT基础知识

ubuntu 安装 eclipse




There are two ways of installing eclipse IDE in ubuntu.
1.Using Ubuntu Software Center Or
2.Download  Eclipse IDE package and then install manually


1.If you use Ubuntu Software Center for installing eclipse,new version of eclipse is not available.

 The above version is 3.7.2-1.However newer version 4.2 juno is available here.


NOTE:Before installing eclipse IDE you need to check few things.

First, whether you have Java installed or not.For that you need to run following command in your terminal...
                                    # java -version
If you get the following output that means Java is not installed on your Ubuntu12.04.You need to  install Sun JDK or Open JDK using Ubuntu Software Center.

And if you get the following output that means you have java installed in your OS.


Second, if you are installing Eclipse IDE for C/C++,you need to check whether g++ is installed or not.
To check whether g++ is installed or not you need to run the following command in the terminal...
                                                 # g++ --version

If you get the following output that means g++ is already installed else you need to install it using Ubuntu Software Center.




2.By manually downloading the eclipse IDE package.
         
         a.First download the eclipse tar.gz package from here.

      
         b.Then righ-click the eclipse tar.gz and choose the extract here option to extract the tar.gz package.You can also use the command line to extract the tar.gz package.
       
                               # tar xzf eclipse-cpp-juno-linux-gtk.tar.gz
            
        
          c.Move the extracted eclipse in the  /opt/ folder.Before running the below commmand be sure that you are in the directory which contains extracted eclipse folder.

                               # mv eclipse /opt/
           
            Use sudo if the above command gives permission denied message.
                                 
                              # sudo mv eclipse /opt/


       d.Create a desktop file and place it into /usr/share/applications
              
                            # sudo gedit /usr/share/applications/eclipse.desktop            
       
           and copy the following to the eclipse.desktop file
  1. [Desktop Entry]
    Name=Eclipse 
    Type=Application
    Exec=/opt/eclipse/eclipse
    Terminal=false
    Icon=/opt/eclipse/icon.xpm
    Comment=Integrated Development Environment
    NoDisplay=false
    Categories=Development;IDE
    Name[en]=eclipse.desktop
 
       e. Create a symlink in /usr/local/bin using
  1.  # cd /usr/local/bin
     # sudo ln -s /opt/eclipse/eclipse

   
       f. Now its the time to launch eclipse.
       
             # /opt/eclipse/eclipse  -clean  &    

2012年11月29日星期四

Ubuntu 12.04中文输入法的安装


Ubuntu 12.04中文输入法的安装
 
Ubuntu上的输入法主要有小小输入平台(支持拼音/二笔/五笔等),Fcitx,Ibus,Scim等。其中Scim和Ibus是输入法框架。
在Ubuntu的中文系统中自带了中文输入法,通过Ctrl+Space可切换中英文输入法。这里我们主要说下Ubuntu英文系统中,中文输入法的安装。
安装输入法的第一步,是安装语言包。我们选择System Settings-->Language Support-->Install/Remove Languages,将弹出以下窗口:  www.2cto.com  
 

 
输入密码后,系统会安装简体中文语言包。
第二步,安装IBus框架,在终端输入以下命令:
sudo apt-get install ibus ibus-clutter ibus-gtk ibus-gtk3 ibus-qt4
启动IBus框架,在终端输入:
im-switch -s ibus
安装完IBus框架后注销系统,保证更改立即生效。
第三步:安装拼音引擎
 
有下面几种常用选择:
IBus拼音:sudo apt-get install ibus-pinyin
IBUS五笔:sudo apt-get install ibus-table-wubi
谷歌拼音输入法:sudo apt-get install ibus-googlepinyin
Sun拼音输入法:sudo apt-get install ibus-sunpinyin
第四步:设置IBus框架  www.2cto.com  
ibus-setup
此时,IBus Preference设置被打开。我们在Input Method选项卡中,选择自己喜欢的输入方式,并配置自己喜欢的快捷键即可。如下图所示:
 

 
第五步:通常情况下,IBus图标(一个小键盘)会出现在桌面右上角的任务栏中。有时候这个图标会自行消失,可使用以下命令,找回消失的IBus图标:
ibus-daemon -drx