Ubuntu 常用操作备记

1. 通过 deb 包安装

安装 .deb 包: sudo dpkg -i package_file.deb

反安装 .deb 包: sudo dpkg -r package_name

 

2. 通过 apt-get 安装

安装 sudo apt-get install package_name

反安装 sudo apt-get remove package_name

 

3. PHPMyAdmin 导入超过2M 的文件

当用它来导入超过 2MB 的数据库文件时,往往会因为受 PHP.ini 上传文件大小的限制而无法导入,解决方法:在 phpMyAdmin 目录下新建一个目录,如: uploadfiles ,再编辑phpMyAdmin 目录下 libraries\ config.default.php 文件,查找 $cfg['UploadDir'] ,将其值写为新建目录的名称。如下所示:程序代码 $cfg['UploadDir'] = 'uploadfiles'; 将要导入到数据库的文件上传到刚才新建的 uploadfiles 文件夹中,登录 phpMyAdmin ,选择你的数据库,在右侧窗口中点击“ import ( 导入 ) ” ,这时你会发现导入界面中多了一个“网站服务器上载目录”选项,点击下拉箭头,列表里会有刚才上传的文件名称列表。选中文件,点击右下角的“执行”按钮,等待一段时间 ( 等待的时间与导入文件体积成正比 ) 即可完成“超重”文件的导入。

 

4. Ubuntu 常用小技巧

UBUNTU 安装完之后,默认把 WIN 的磁盘全部挂接上去了,这时候桌面是全部是磁盘图标,如何在 UBUNTU 下掉桌面的磁盘图标,其实很简单的:

1>. 就是在终端输入: gconf-editor

2>. 依次展开: apps -> nautilus -> desktop

3>. 然后如果想在桌面显示下面的图标请分别勾选这几个键值:

* computer_icon_visible ( 计算机图标 )

* home_icon_visible ( 主文件夹图标 )

* trash_icon_visible ( 回收站图标 )

* vomules_visible ( 自动挂载的磁盘 )

 

5. 右键添加终端

sudo apt-get install nautilus-open -terminal

 

janwer@janwer-desktop:~$ sudo apt-get install apache2 libapache2-mod-jk

 

直接用 apt-get 安装就可以了,这样比较方便,因为我主要用于开发测试,不作服务器用途,不需要用麻烦的编译安装方法所以偷了一下懒。从官网上下载 Tomcat5.5 解压到 /opt/tomcat-5.5 目录下。

 

安装完毕后为了整合 apache tomcat ,需要做一些配置:

1>. tomcat 目录的 conf 文件夹下创建 jk.properties 文件,在里面加入

handler.list=channelSocket,request

channelSocket.port=8009

 

2>. 修改 httpd.conf 文件

sudo cp /usr/share/doc/libapache2-mod-jk/httpd_example_apache2.conf /etc/apache2/

 

然后将 /etc/apache2/httpd_example_apache2.conf 里的内容复制到

/etc/apache2/httpd.conf 目录下 , 最后修改内容如下:

ServerName 192.168.123.168

JkAutoAlias /opt/tomcat5.5/webapps

#DirectoryIndex index.html index.html.var index.htm index.jsp index.php

# for all commands/options available see the manual

# provided in libapache-mod-jk-doc package.

# The location where mod_jk will find the workers definitions

JkWorkersFile /etc/libapache2-mod-jk/workers.properties

# The location where mod_jk is going to place its log file

JkLogFile /var/log/apache2/mod_jk.log

# The log level:

# - info log will contain standard mod_jk activity (default).

# - warn log will contain non fatal error reports.

# - error log will contain also error reports.

# - debug log will contain all information on mod_jk activity

# - trace log will contain all tracing information on mod_jk activity

JkLogLevel info

# Assign specific URLs to Tomcat. In general the structure of a

# JkMount directive is: JkMount [URL prefix] [Worker name]

# send all requests ending in .jsp to ajp13_worker

JkMount /*.jsp ajp13_worker

# send all requests ending /*.do to ajp13_worker

JkMount /*.do ajp13_worker

 

3>. 修改 workers.properties

sudo vi /etc/libapache2-mod-jk/workers.properties

最后修改后的内容如下:

# workers.tomcat_home should point to the location where you

# installed tomcat. This is where you have your conf, webapps and lib

# directories.

# 我的 tomcat 目录

workers.tomcat_home=/opt/tomcat5.5

#

# workers.java_home should point to your Java installation. Normally

# you should have a bin and lib directories beneath it.

# 我的 JDK 安装目录

workers.java_home=/usr/local/jdk1.5.0_15

 

4>. 中文乱码问题

sudo vi /opt/tomcat5.5/conf/server.xml

我采用的都是 UTF-8 编码的,在 tomcat 中的设置如下(其它编码类似):

<Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" useBodyEncodingForURI="true" />

 

<!-- Define an AJP 1.3 Connector on port 8009 -->

<Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" useBodyEncodingForURI="true" />

 

sudo vi /etc/apache2/conf.d/charset

# Read the documentation before enabling AddDefaultCharset.

# In general, it is only a good idea if you know that all your files

# have this encoding. It will override any encoding given in the files

# in meta http-equiv or xml encoding tags.

AddDefaultCharset UTF-8

 

文件权限参考:

https://help.ubuntu.com/community/FilePermissions

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值