---
title: "使用Ubuntu当桌面了"
author: "8366"
date: "2010-12-11T18:05:26Z"
tags: []
categories: ["操作系统"]
slug: "ubuntu"
draft: false
lastmod: "2010-12-14T11:56:04Z"
id: 839675
url: "https://8366.iteye.com/blog/839675"
---

1.升级 package

 

2.安装ssh server

 

  默认安装完Ubuntu 后是安装了 ssh-client 的，需要我们手动安装 server

 

   ps -e |grep ssh

 

   sudo apt-get install openssh-server

   启动  /etc/init.d/ssh start

 

2.安装 virtbox 使用 新立得安装 可以避免处理依赖关系

 

3\. virtboxtools ，他会挂载到虚拟机的光驱中，然后到vm的光驱里找到exe 文件安装（能动态设置屏幕分辨率）

 

4.安装网卡驱动 ，在硬件管理中选择网卡 选择AMD的

 

5\. 英文ubuntu下安装中文输入法

 

先用系统自带的SCIM输入法。  
安装方法很简单，在你安装好系统，并确定正确联网后，在屏幕左上角有三个菜单，选择：系统--&gt;系统管理--&gt;语言支持（在你那里有可能是英文），选择中文，并勾选使用SCIM，，确定后系统会下载中文语言包并自动安装SCIM。  
重启生效。

 

 

6\. 安装java环境

 

http://8366.iteye.com/blog/376982

 

7.安装 eclipse

1、官方下载：http://www.eclipse.org/downloads/

2、解压到指定目录：/opt  
可先解压到当前目录然后  
mv eclipse /opt

(1)如果想把eclipse目录的更改为root拥有，可以执行下面的命令  
sudo chown -R root:root /opt/eclipse  
在/usr/bin目录下创建一个启动脚本eclipse

(2)用下面的命令来创建：  
sudo gedit /usr/bin/eclipse

然后在该文件中添加以下内容：  
#!/bin/sh  
export MOZILLA\_FIVE\_HOME=”/usr/lib/mozilla/”  
export ECLIPSE\_HOME=”/opt/eclipse”

$ECLIPSE\_HOME/eclipse $*

（3）让修改该脚本的权限，让它变成可执行，执行下面的命令：  
sudo chmod +x /usr/bin/eclipse

3、在桌面或者gnome菜单中添加eclipse启动图标

（1）在桌面或者启动面板上添加图标：  
在桌面（右键单击桌面-&gt;创建启动器）或面板（右键单击面板-&gt;添加到面板 -&gt;定制应用程序启动器）上创建一个新的启动器，然后添加下列数据：

名称：Eclipse Platform  
命令：eclipse  
图标： /opt/eclipse/icon.xpm

（2）在Applications（应用程序）菜单上添加一个图标  
用文本编辑器在/usr/share/applications目录里新建一个名为eclipse.desktop的启动器，如下面的命令:

sudo vi /usr/share/applications/eclipse.desktop  
或者  
sudo gedit /usr/share/applications/eclipse.desktop

然后在文件中添加下列内容：

\[Desktop Entry]  
Encoding=UTF-8  
Name=Eclipse Platform  
Comment=Eclipse IDE  
Exec=eclipse  
Icon=/opt/eclipse/icon.xpm  
Terminal=false  
StartupNotify=true  
Type=Application  
Categories=Application;Development;

保存文件。完成整个安装过程。可以双击桌面eclipse的图标来运行eclipse。

 

**8.安装tomcat**  

我遇到了权限问题 使用 sudo chown -R xiaoliang:xiaoliang /opt/apache-tomcat-5.5.20/  解决

 

buntu下手动安装Tomcat，而非通过apt安装。我们选择二进制包，直接解压缩就能用。  
平台：Ubuntu7.04， jdk "1.6.0"  
1、关于Ubuntu的安装，请参照Ubuntu cn的[wiki](http://wiki.ubuntu.org.cn/index.php?title=Navigation&variant=zh-cn)  
2、关于Ubuntu中jdk的安装，请参照Ubuntu cn wiki中的[《Java安装配置》](http://wiki.ubuntu.org.cn/index.php?title=Java%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE&variant=zh-cn)

一、安装Tomcat5.5.20  
1、下载安装包  
wget http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5.20.tar.gz  
2、解压缩／安装  
tar -zxvf apache-tomcat-5.5.20.tar.gz  
sudo mv apache-tomcat-5.5.20 /opt/  
3、 启动Tomcat  
cd /opt/ apache-tomcat-5.5.20 /bin  
sudo ./starup.sh #关闭的脚本为shutdown.sh

一般，看到类似以下信息就对了：  
Using CATALINA\_BASE:   /opt/apache-tomcat-5.5.20  
Using CATALINA\_HOME:   /opt/apache-tomcat-5.5.20  
Using CATALINA\_TMPDIR: /opt/apache-tomcat-5.5.20/temp  
Using JRE\_HOME:       /usr/lib/jvm/java-6-sun-1.6.0.00

4、测试  
在Firefox地址栏中输入  
http://localhost:8080

二、安装Tomcat Administration  
Tomcat5.5默认情况下没有安装Tomcat Administration的，必须自己安装。  
1、下载  
wget http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5.20-admin.tar.gz  
2、解压缩／安装  
tar -zxvf apache-tomcat-5.5.20-admin.tar.gz #这里默认解压出来的文件夹为apache-tomcat-5.5.20，直接覆盖到Tcomcat安装目录就行了  
sudo mv apache-tomcat-5.5.20 /opt/  
3、添加管理员账号密码  
修改apache-tomcat-5.5.20/conf/tomcat-users.xml  
加入  
   &lt;user username="manager" password="manager" roles="manager"/&gt;  
   &lt;user username="admin" password="admin" roles="admin,manager"/&gt;  
保存退出，重启tomcat  
4、登录管理员帐号  
在Firefox的地址栏中输入http://localhost:8080/，点击左边的 Tomcat Administration链接，进入admin的登录页面，输入用户名密码admin  
5、如果点击Tomcat Administration时出现如下提示：  
Tomcat's administration web application is no longer installed by default. Download and install the "admin" package to use it.  
说明Tomcat Administration还没启动。  
    点击页面左上角的Status就进入了sever status  
    点击左上角的List Applications  
    在list里能看到/admin。其running 项是false，在后面的Commands项里点击start。  
    好了，现在可以用了。

三、配置MySQL数据库连接池  
1、 启动Tomcat，打开Firefox在地址栏内输入http://localhost:8080/admin 进入Tomcat的管理界面；点击右边的Data Sources 在右上角的下拉菜单中选择Create New Data Source 在下边的输入框中输入需要的配置信息。之后保存并提交。  
JNDI Name:jdbc/myDBPool              //（myDBPool为自己所命的名字）  
Data Source URL：jdbc:mysql://localhost:3306/testdb  
JDBC Driver Class: com.mysql.jdbc.Driver"  
User Name:root //根据你的MySQL数据库的用户名密码  
Password: 123456 //  
Max. Active Connections: 4         //最大连接数  
Max. Idle Connections: 2           //最大的空闲连接数  
Max. Wait for Connection:5000      //最大等待连接时间

2、配置tomcat添加JDBC驱动  
首先要下载安装mysql-connector-java-3.1.12.tar.gz驱动，然后将mysql-connector-java-3.1.12-bin.jar文件放到Tomcat安装路下的common/lib下。

3、配置tomcat安装路下的/conf/context.xml文件，添加如下内容：  
&lt;Resource name="jdbc/myDBPool" type="javax.sql.DataSource" maxActive="4" maxIdle="2" maxWait="5000" username="root" password="123456" driverClassName="    com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/testdb"/&gt;

4、测试：编写JSP文件。

![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)&lt;% ... @ page language = " java " import = " java.util.* " pageEncoding = " UTF-8 " %&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif) &lt;% ... @ page import = " java.sql.* " %&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif) &lt;% ... @ page import = " javax.sql.* " %&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif) &lt;% ... @ page import = " javax.naming.* " %&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif) &lt;! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" &gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif) &lt; html &gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)      &lt; head &gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)          &lt; title &gt; tomcat数据库连接池技术测试 &lt;/ title &gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)      &lt;/ head &gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)      &lt; body &gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)          Tomcat数据库连接池测试  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)          &lt; br &gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)          &lt;% ...  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              Connection conn = null ;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              Context initCtx = new InitialContext();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              Context ctx = (Context) initCtx.lookup( " java:comp/env " );  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              javax.sql.DataSource ds = (javax.sql.DataSource) ctx  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)                      .lookup( " jdbc/myDBPool " );  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              conn = ds.getConnection();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              Statement stmt = conn.createStatement();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              PreparedStatement ps = conn.prepareStatement( " select * from testtb " );  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              ResultSet rs = ps.executeQuery();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              while (rs.next()) {  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)                  out.println(rs.getLong( 1 ) + " &lt;br&gt; " );  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)                  out.println(rs.getString( 2 ) + " &lt;br&gt; " );  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              }  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              rs.close();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              stmt.close();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              conn.close();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)              out.println( " 测试成功 " );  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)          %&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)       &lt;/ body &gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif) &lt;/ html &gt;