You are currently browsing the archives for the ubuntu server category.

Archive for the ‘ubuntu server’ Category

ubuntu10.04 翻墙

星期五, 8月 27th, 2010

有墙的世界是和谐的社会,但是没有墙的世界,才是真实的世界。本文所涉及的内容仅供学习交流之用,无论你以后看到什么,请你热爱自己的国家。

本文来自转载 : http://hi.baidu.com/%CE%B0%CE%B0%D0%A1%CE%D1/blog/item/0802884e0776a43bafc3ab98.html

一、需要一个远程主机的登录帐号,点击这里去免费注册一个帐号就行了,这个网站注册很简单,我自己用着感觉速度还是挺快到。收到回复邮件后,按照提示激活帐号,然后便会收到第二封邮件,告诉你服务器名称、帐号、密码,如下所示:
Hostname:       shell.cjb.net
Username:       ************
Password:        ************

二、安装一个firefox插件——AutoProxy,这个插件能帮你自动判断,哪些网站需要翻墙,哪些网站不需要。安装插件后,会提示你订阅gfw的列表,这张列表中记录了被墙的网站地址。
接着设置这个软件,在firefox的状态栏里面,有个写着“福”字到图标,点击便进入了设置,在“代理服务器”菜单项中点击“选择代理服务器”一项:

默认的主代理为Tor,改成ssh -D就行了:

三、修改firefox的代理DNS设置,再浏览器地址一栏输入about:config,然后会出现

选择“我保证会小心”,然后在过滤器里面输入
network.proxy.socks_remote_dns,如下图所示:

接着,双击下面出现的那一项,你会发现,它到值已经变为true了:

这样,firefox的设置就完成了。

四、登录远程服务器:
sudo ssh -qTfnN -D 7070 用户名@shell.cjb.net

然后输入yes:

再接着输入你的密码,就行了。下面,来看看墙外的世界:

世界是如此的美好,只是等待你去发现。本文所涉及到内容,都来自网上前辈们的经验,我只是做个总结,非常感谢他们的分享。

分享家:Addthis中国

ubuntu10.04 的 php5.3 降级 到 php5.2

星期三, 5月 26th, 2010

ubuntu10.04 的php版本是 php5.3, 很多程序可能不支持, 降级到php5.2 的方法如下:


01 sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr"\n" " "`


02 echo -e "Package: php5\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee /etc/apt/preferences.d/php > /dev/null
03 apt-cache search php5-|grep php5-|awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}'|sudo tee -a /etc/apt/preferences.d/php > /dev/null
04 apt-cache search -n libapache2-mod-php5 |awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}'| sudo tee -a /etc/apt/preferences.d/php > /dev/null
05 echo -e "Package: php-pear\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee -a /etc/apt/preferences.d/php > /dev/null

06 grep 'main restricted' /etc/apt/sources.list|grep -v "#"| seds/lucid/karmic/g | sudo tee/etc/apt/sources.list.d/karmic.list > /dev/null

07 sudo apt-get update

08 sudo aptitude install -t karmic php5-cli php5-cgi

09 sudo aptitude hold `dpkg -l | grep php5| awk '{print $2}' |tr"\n" " "`
来源:http://mrkandy.wordpress.com/2010/04/16/install-php-5-2-x-in-ubuntu-10-04-lucid/
分享家:Addthis中国

ubuntu 10.01 restart mysql

星期日, 5月 9th, 2010

yaozer@local:~$ sudo /etc/init.d/mysql restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart mysql
mysql start/running, process 18095
yaozer@local:~$ sudo restart mysql
mysql start/running, process 18137

分享家:Addthis中国

ubuntu 10.04 倒计时

星期一, 4月 19th, 2010

ubuntu 10.04 倒计时

分享家:Addthis中国

ubuntu 增加新硬盘

星期五, 4月 16th, 2010

ubuntu 增加新硬盘的方法详解,  先中文概述, 英文好的,可以看后面的英文,更详细。

———————————————-中文  ubuntu 增加新硬盘的方法详解——————–

1 接上新硬盘

2 启动Ubuntu,root用户登录。

在终端输入:fdisk -l ,可以看到

—————————————————————————-

Disk /dev/sda: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0×000af383

Device Boot Start End Blocks Id System

/dev/sda1 * 1 1244 9992398+ 83 Linux

/dev/sda2 1245 1305 489982+ 5 Extended

/dev/sda5 1245 1305 489951 82 Linux swap / Solaris

Disk /dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0×00000000

Disk /dev/sdb doesn’t contain a valid partition table

—————————————————————————-

这里可以看到/dev/sdb 就是我们新添加的硬盘,我们需要给新的硬盘分区。

在终端输入:fdisk /dev/sdb

之后键入:m,可以看到帮助信息,

键入:n,添加新分区

键入:p,选择添加主分区

键入:l,选择主分区编号为1,这样创建后的主分区为sdb1

之后,fdisk会让你选择该分区的开始值和结束值,开始值默认,  结束值可以输入形如  +200000M,  就是 200G 空间。

可以建立多个分区, 最后键入:w,保存所有并退出,完成新硬盘的分区。

3 格式化磁盘

在终端输入:sudo mkfs -t ext3 /dev/sdb1

用ext3格式对/dev/sdb1 进行格式化

使用1% 作为保留空间(默认为 5%, yaozer认为数据分区不需要那么多)

sudo tune2fs -m 1 /dev/sdb1

4 挂载该分区:

手动挂载:

在终端输入:mkdir /data ,创建新的硬盘的挂载点

在终端键入:mount /dev/sdb1 /data ,将该新分区挂载到/data/这个目录下开机自动挂载

修改/etc/fstab文件,添加如下行:

/dev/sdb1 /data ext3 defaults, 0 2

———————————-英文详解———————————————————–

1) Initiate fdisk with the following command:

  •   sudo fdisk /dev/sdb

2) Fdisk will display the following menu:

  •   Command (m for help): m <enter>
      Command action
       a   toggle a bootable flag
       b   edit bsd disklabel
       c   toggle the dos compatibility flag
       d   delete a partition
       l   list known partition types
       m   print this menu
       n   add a new partition
       o   create a new empty DOS partition table
       p   print the partition table
       q   quit without saving changes
       s   create a new empty Sun disklabel
       t   change a partition's system id
       u   change display/entry units
       v   verify the partition table
       w   write table to disk and exit
       x   extra functionality (experts only)
    
      Command (m for help):

3) We want to add a new partition. Type “n” and press enter.

  Command action
   e   extended
   p   primary partition (1-4)

4) We want a primary partition. Enter “p” and enter.

  Partition number (1-4):

5) Since this will be the only partition on the drive, number 1. Enter “1″ and enter.

  Command (m for help):

If it asks about the first cylinder, just type “1″ and enter. (We are making 1 partition to use the whole disk, so it should start at the beginning.)

6) Now that the partition is entered, choose option “w” to write the partition table to the disk. Type “w” and enter.

  The partition table has been altered!

7) If all went well, you now have a properly partitioned hard drive that’s ready to be formatted. Since this is the first partition, Linux will recognize it as /dev/sdb1, while the disk that the partition is on is still /dev/sdb.

Command Line Formatting

To format the new partition as ext3 file system (best for use under Ubuntu):

  •   sudo mkfs -t ext3 /dev/sdb1

To format the new partition as fat32 file system (best for use under Ubuntu & Windows):

  •   sudo mkfs -t fat32 /dev/sdb1

As always, substitute “/dev/sdb1″ with your own partition’s path.

Modify Reserved Space (Optional)

When formatting the drive as ext2/ext3, 5% of the drive’s total space is reserved for the super-user (root) so that the operating system can still write to the disk even if it is full. However, for disks that only contain data, this is not necessary.

NOTE: You may run this command on a fat32 file system, but it will do nothing; therefore, I highly recommend not running it.

You can adjust the percentage of reserved space with the “tune2fs” command, like this:

 sudo tune2fs -m 1 /dev/sdb1

This example reserves 1% of space - change this number if you wish.

  • Using this command does not change any existing data on the drive. You can use it on a drive which already contains data.

Create A Mount Point

Now that the drive is partitioned and formatted, you need to choose a mount point. This will be the location from which you will access the drive in the future. I would recommend using a mount point with “/media”, as it is the default used by Ubuntu. For this example, we’ll use the path “/media/mynewdrive”

  •   sudo mkdir /media/mynewdrive

Now we are ready to mount the drive to the mount point.

Mount The Drive

You can choose to have the drive mounted automatically each time you boot the computer, or manually only when you need to use it.

Automatic Mount At Boot

You’ll need to edit /etc/fstab:

  •   gksu gedit /etc/fstab

Add this line to the end (for ext3 file system):

  •   /dev/sdb1    /media/mynewdrive   ext3    defaults     0        2

Add this line to the end (for fat32 file system):

  •   /dev/sdb1    /media/mynewdrive   vfat    defaults     0        2

    The defaults part may allow you to read, but not write. To write other partition and FAT specific options must be used. If gnome is being used, use the right-click, mount method. Then launch the mount command from terminal, no options. The last entry should be the FAT drive and and look something like:

      /dev/sda5 on /media/mynewdrive type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)

    All of the parts between the parenthesis are the mount options and should replace “defaults” in the fstab file. The “2″ at the end instructs your system to run a quick file system check on the hard drive at every boot. Changing it to “0″ will skip this. Run ‘man fstab’ for more info here.

You can now run “sudo mount -a” (or reboot the computer) to have the changes take effect.

If you want to allow a normal user to create files on this drive, you can either give this user ownership of the top directory of the drive filesystem: (replace USERNAME with the username)

  •   sudo chown -R USERNAME:USERNAME /media/mynewdrive

or in a more flexible way, practical if you have several users, allow for instance the users in the plugdev group (usually those who are meant to be able to mount removable disks, desktop users) to create files and sub-directories on the disk:

  •   sudo chgrp plugdev /media/mynewdrive
      sudo chmod g+w /media/mynewdrive
      sudo chmod +t /media/mynewdrive

The last “chmod +t” adds the sticky bit, so that people can only delete their own files and sub-directories in a directory, even if they have write permissions to it (see man chmod).

Manually Mount

Alternatively, you may want to manually mount the drive every time you need it.

For manual mounting, use the following command:

sudo mount /dev/sdb1 /media/mynewdrive

When you are finished with the drive, you can unmount it using:

sudo umount /media/mynewdrive

That’s it

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

分享家:Addthis中国

ubuntu 安装 apc 缓存

星期五, 3月 26th, 2010

APC, Alternate PHP Cache, is now the most maintained free/open source op-code cache, and is being used more and more as it emerges to be the most stable.

The instructions here detail how to get APC running on an Ubuntu server running Gutsy Gibbon 7.10.

First, we need the pecl command so we can download and install APC from the repositories.

Do to so, we execute the following command:

aptitude install php-pear

But, this will not run on its own, we need the following package for the phpize command:

aptitude install php5-dev

We also need the apxs command, which is installed via the following package:

aptitude install apache2-dev

Now we have all the software we need, so we install apc via the pecl command:

pecl install apc

Once that finishes, we need to enable apc in Apache’s configuration. the following command should do this for us.

echo "extension=apc.so" > /etc/php5/apache2/conf.d/apc.ini

Then we restart Apache:

 /etc/init.d/apache2 restart

And we are all done. Watch for less execution time per page, and decreased memory usage per Apache process compared to what you had before.

分享家:Addthis中国

ubuntu安装雷鸟thunderbird 3

星期五, 2月 26th, 2010

最新Mozilla的邮件客户端thunderbird 3前段时间已经发行了,不过现在只有tar格式的包可以提供下载,需要自己通过源码编译安装,本篇说下如何使用PPA源在ubuntu 终端里直接输入命令安装thunderbird 3.0 或者 3.1测试版。

对于ubuntu 9.10版本,在终端中通过如下命令添加Mozilla PPA

sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa

对于ubuntu 9.04 8.10 通过编辑/etc/apt/sources.list添加,在终端输入:

sudo gedit /etc/apt/sources.list

9.04版本使用如下命令中添加:

deb http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main

8.10版本使用如下命令中添加:

deb http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu intrepid main
deb-src http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu intrepid main

要添加gpg key :

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 247510BE

最后通过如下命令安装3.0或者3.1版本:

开始安装 3.0

sudo apt-get update

sudo apt-get install thunderbird-3.0 thunderbird-3.0-gnome-support

开始安装 3.1

sudo apt-get update
sudo apt-get install thunderbird-3.1 thunderbird-3.1-gnome-support

来源: http://www.ourubuntu.com/software/2009/1223/ubuntu-thunderbird-install.html

分享家:Addthis中国

ubuntu的2个小技巧

星期五, 11月 6th, 2009

1,  自动识别GBK编码的文件:  alt+f2 ,  gconf-editor  ,  /apps/gedit-2/preferences/encodings/auto_detected 增加 GB18030, ISO-8859-1, GBK .

2. 双击某文件直接编辑:  打开任一目录启动Nautilus, 在Nautilus Edit/Preferences/Behavior 选择 View executable text files when they are opened.

分享家:Addthis中国

ubuntu9.10图标icon消失解决办法

星期六, 10月 31st, 2009

1,  桌面右键 -> change desktop background -> interface -> 勾选 show icons in menus

这样 很多icon就已经恢复了。

2, 激活某些按钮前面的icon, ALT+F2  -> 输入 gconf-editor  运行 -> desktop/gnome/interface 勾选buttons_have_icons

来源: http://www.youtube.com/watch?v=j-3wHQ8rX7I

分享家:Addthis中国

ubuntu9.04 成功升级到 9.10

星期六, 10月 31st, 2009

ubuntu9.04 成功升级到 9.10, 没遇到什么问题, 增加了几个软件:

  • ubuntu software center
  • empathy im client, 能自动导入pidgin账号,不过我已经习惯了pidgin
  • ubuntu one, 2G的免费网络空间
  • 其他一些小工具

总得来说, 我的ubuntu常用软件基本定型了,这些软件对我没什么吸引力。

ubuntu 9.10 让我惊喜的地方是:

  • 开机界面更cool了一点
  • 音视频的质量似乎有所提高
  • flash全屏时没以前那么卡了
  • 很多软件升级了, ubuntu有些软件更新太慢了

唯一遗憾的地方是:

  • 有些菜单的icon消失了
分享家:Addthis中国