思爱

有时候,我们对别人的小恩小惠感激不尽,却对亲人一辈子的恩情视而不见。

做石如做人

Posted By 思爱 on 2010年05月29日

好的玉石工艺品为何这么值钱?

很多人没搞懂其中的道理,以为是材料值钱,艺术家技艺高超,做出来的玉石就值钱了。

这个理解层面太肤浅了,美玉之所以能成为中国历史上最有价值之一的物品,主要是它“可靠”,它已经成为潜规则的硬通货。

每一个成功的玉石商人都深谙其道:保值!不管你多便宜进回来的材料,经过你的加工,最重要是让它保值,任何时候你都得以九折售价去回收自己所卖出宝石。

当你的目标是卖工艺品,希望尽量多卖,利润自然就有限。当你的目标是开银行,玉石只是一个不记名的存折,那这门生意就不可限量了。

Discuz! 远程附件修改回到本地

Posted By 思爱 on 2010年04月14日

很简单:1、把附件复制回本地服务器;

2、运行SQL命令:update cdb_attachments set remote = ‘0′

远程重装Linux服务器

Posted By 思爱 on 2010年01月19日

敬告:以下方法风险很大,有可能导致你的服务器无法恢复联网,请想要尝试者慎之又慎。本人用此方法成功重装系统,并不代表对你也一定适用。以此如果导致你的服务器出现重启失败、死机、崩溃、瓦解、爆炸、消失等等情况,本人概不负责,请自行斟酌进行。另外远程安装要求你的服务器连接到mirror.centos.org的网速足够快,只能局域网访问的服务器不适用此方法。教育网用户因此方法导致的高额出国流量费用请自行买单。

我有一台FC9做服务器,感觉不稳定,想装成CentOS 5.2。但是服务器在地球的另一边(洛杉矶),找机房的人装要收我50美元。。。。。。(如想安装Fedora请看这:http://fedorasolved.org/installation-solutions/installing-fedora-using-pxe-images)

于是就有了这次的远程安装经历。

首先以root身份ssh连到服务器,输入命令

cd /boot

wget http://mirror.centos.org/centos/5.2/os/i386/images/pxeboot/initrd.img

wget http://mirror.centos.org/centos/5.2/os/i386/images/pxeboot/vmlinuz

mv initrd.img img.pxe

mv vmlinuz kernel.pxe

然后编辑 /boot/grub/menu.lst
增加一个启动项

title CentOS Install (PXE)

root (hd0,0)

kernel /kernel.pxe vnc vncpassword=设定密码 headless ip=服务器IP netmask=255.255.255.0 gateway=网关IP dns=DNSIP hostname=localhost.localdomain ksdevice=eth0 method=http://mirror.centos.org/centos/5.2/os/i386/ lang=en_US keymap=us

initrd /img.pxe

然后修改default的值到上述启动项,存盘退出。
反复检测两遍没有问题的话,reboot
等上两三分钟,在本地执行

vncviewer 服务器IP:5901

打开vnc了窗口,输入设定密码。则进入了远程安装CentOS的图形界面!!!!

之后的一切安装工作和本机安装完全相同。搞完之后,服务器就从FC9摇身一变,成了CentOS 5.2

Fedora 12的PXE文件下载网址:http://download.fedora.redhat.com/pub/fedora/linux/releases/12/Fedora/x86_64/os/images/pxeboot/

安装文件夹:http://download.fedora.redhat.com/pub/fedora/linux/releases/12/Fedora/x86_64/os/

通过网络安装,缺省是不安装桌面的,SSH登录后,还需要执行一下:

yum groupinstall “GNOME Desktop Environment”

重装GNOME桌面环境。

Discuz! 5 6 7 隐藏远程附件的真实地址的方法

Posted By 思爱 on 2009年11月17日

远程附件其实是个很不错的功能,利用单独服务器的空间和流量,节省主论坛的资源,加快论坛速度提高稳定性。

不过,目前有个不小的缺憾:如果隐藏远程附件的真实地址,就没法充分利用附件服务器的带宽,还会加大主论坛的流量,加重主论坛的负担。如果不隐藏真实地址,下载附件后,文件名又都会变乱码。

单个文件还好说,处理分卷压缩的文件就要累死了。

从5.5、6.0、6.1一直到目前的7.0,官方论坛也一直没有解决这个问题。不过现在终于可以解决了,现在免费提供给大家使用。使用方法如下:

把附件中的down.php复制到远程附件目录下。比如,远程附件设置的路径是http://remotehost/remoteattach/,就要把down.php放在远程附件服务器的remoteattach目录下。

2、修改论坛中的bbs/attachment.php文件。

找到如下内容(DZ6.0第152行,DZ6.1第133行,在DZ7.0版本中,第139行):

  1. dheader(‘location:’.$ftp['attachurl'].’/’.$attach['attachment']);


将该行内容修改为下面四行(修改前请自行备份原来的文件/修改时请直接复制粘贴,不要手工输入

  1. if($isimage && !empty($noupdate))
  2. dheader(‘location:’.$ftp['attachurl'].’/’.$attach['attachment']);
  3. else
  4. dheader(‘location:’.$ftp['attachurl'].’/down.php?name=’.urlencode($attach['filename']).’&host=’.$attach['attachment']);


需要注意的地方:
1、如果需要远程附件支持断点续传和多线程下载,请把down.php中的”$readmod = 2″改为”$readmod = 4″;
2、论坛的附件设置里面,附件保存方式不可以选择: 标准(全部存入同一目录);
3、远程附件目录不要放置可以运行的程序,否则程序脚本可能会被非法读取。

下载:

远程附件_PHP

在Ubuntu配置硬件温度监控模块

Posted By 思爱 on 2009年10月28日

0R55363N-0

最近看了《温度决定生老病死》,而电脑也是《温度决定状态和寿命》,监测服务器各部件工作温度是非常重要的。我曾经有一台服务器屡屡坏硬盘,经监测后发现温度达60度,后来增加一个小风扇使其降到40度,故障就再也没有发生了。下面详述安装过程:

第一步:安装lm-sensors和sensors-applet(也可以选用后面新找到的一个软件CompTemp Monitor),打开终端输入:

sudo apt-get install lm-sensors sensors-applet

根据提示键入Root密码,然后等待下载并安装完后关闭终端。在你想要显示传感器温度的面板位置右键,选择“添加到面板”菜单命令,在列表中选择 “Hardware Sensors Monitor”后单击“添加”按钮即可添加该Applet程序。能直接检测到传感器那最好了。如果没有检测到传感器(我的就没有显示),显示”No sensors found”则转到下一步。

第二步:手动配置传感器:

Ubuntu安装的时候可能没有对传感器进行配置,需要手动配置传感器。lm-sensors软件提供了一个非常好的命令:sensors- detect,会自动侦测所需模块,类似Windows软件常见的“下一步”模式,引导你配置好传感器,向导中的问题按提示回答“Yes”或者 “ENTER”.一般一路下去输入”Yes”/”ENTER”就可以了,我检测配置的时候就一路Yes和ENTER.

在终端输入:

sudo sensors-detect

过程:

louis@Ubuntu-desktop:~$ sudo sensors-detect
# sensors-detect revision 4171 (2006-09-24 03:37:01 -0700)

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you’re doing.

We can start with probing for (PCI) I2C or SMBus adapters.
Do you want to probe now? (YES/no): yes
Probing for PCI bus adapters…
Use driver `i2c-viapro’ for device 0000:00:11.0: VIA Technologies VT8233A/8235 South Bridge

We will now try to load each adapter module in turn.
Module `i2c-viapro’ already loaded.
If you have undetectable or unsupported adapters, you can have them
scanned by manually loading the modules before running this script.

To continue, we need module `i2c-dev’ to be loaded.
Do you want to load `i2c-dev’ now? (YES/no): yes
Module loaded successfully.

We are now going to do the I2C/SMBus adapter probings. Some chips may
be double detected; we choose the one with the highest confidence
value in that case.
If you found that the adapter hung after probing a certain address,
you can specify that address to remain unprobed.

Next adapter: SMBus Via Pro adapter at 0400
Do you want to scan it? (YES/no/selectively): yes
Client found at address 0×4c
Handled by driver `lm90′ (already loaded), chip type `lm90′
Client found at address 0×4e
Probing for `National Semiconductor LM75′… No
Probing for `Dallas Semiconductor DS1621′… No
Probing for `Analog Devices ADM1021′… No
Probing for `Analog Devices ADM1021A/ADM1023′… No
Probing for `Maxim MAX1617′… No
Probing for `Maxim MAX1617A’… No
Probing for `TI THMC10′… No
Probing for `National Semiconductor LM84′… No
Probing for `Genesys Logic GL523SM’… No
Probing for `Onsemi MC1066′… No
Probing for `Maxim MAX1619′… No
Probing for `National Semiconductor LM82/LM83′… No
Probing for `Maxim MAX6659′… No
Probing for `Maxim MAX6633/MAX6634/MAX6635′… No
Probing for `ITE IT8201R/IT8203R/IT8206R/IT8266R’… No
Probing for `Fintek F75111R/RG/N (GPIO)’… No
Probing for `Fintek F75121R/F75122R/RG (VID+GPIO)’… No
Client found at address 0×50
Probing for `Analog Devices ADM1033′… No
Probing for `Analog Devices ADM1034′… No
Probing for `SPD EEPROM’… Success!
(confidence 8, driver `eeprom’)
Probing for `EDID EEPROM’… No
Probing for `Maxim MAX6900′… No
Client found at address 0×51
Probing for `Analog Devices ADM1033′… No
Probing for `Analog Devices ADM1034′… No
Probing for `SPD EEPROM’… Success!
(confidence 8, driver `eeprom’)
Client found at address 0×69

Some chips are also accessible through the ISA I/O ports. We have to
write to arbitrary I/O ports to probe them. This is usually safe though.
Yes, you do have ISA I/O ports even if you do not have any ISA slots!
Do you want to scan the ISA I/O ports? (YES/no): yes
Probing for `National Semiconductor LM78′ at 0×290… No
Probing for `National Semiconductor LM78-J’ at 0×290… No
Probing for `National Semiconductor LM79′ at 0×290… No
Probing for `Winbond W83781D’ at 0×290… No
Probing for `Winbond W83782D’ at 0×290… No
Probing for `Winbond W83627HF’ at 0×290… No
Probing for `Silicon Integrated Systems SIS5595′… No
Probing for `VIA VT82C686 Integrated Sensors’… No
Probing for `VIA VT8231 Integrated Sensors’… No
Probing for `AMD K8 thermal sensors’… No
Probing for `IPMI BMC KCS’ at 0xca0… No
Probing for `IPMI BMC SMIC’ at 0xca8… No

Some Super I/O chips may also contain sensors. We have to write to
standard I/O ports to probe them. This is usually safe.
Do you want to scan for Super I/O sensors? (YES/no): yes
Probing for Super-I/O at 0×2e/0×2f
Trying family `ITE’… Yes
Found `ITE IT8705F Super IO Sensors’ Success!
(address 0×290, driver `it87′)
Trying family `National Semiconductor’… No
Trying family `SMSC’… No
Trying family `VIA/Winbond/Fintek’… No
Probing for Super-I/O at 0×4e/0×4f
Trying family `ITE’… Yes
Found `ITE IT8705F Super IO Sensors’ Success!
(address 0×290, driver `it87′)
Trying family `National Semiconductor’… No
Trying family `SMSC’… No
Trying family `VIA/Winbond/Fintek’… No

Now follows a summary of the probes I have just done.
Just press ENTER to continue: ENTER

Driver `lm90′ (should be inserted):
Detects correctly:
* Bus `SMBus Via Pro adapter at 0400′
Busdriver `i2c-viapro’, I2C address 0×4c
Chip `lm90′ (confidence: 6)

Driver `eeprom’ (should be inserted):
Detects correctly:
* Bus `SMBus Via Pro adapter at 0400′
Busdriver `i2c-viapro’, I2C address 0×50
Chip `SPD EEPROM’ (confidence: 8)
* Bus `SMBus Via Pro adapter at 0400′
Busdriver `i2c-viapro’, I2C address 0×51
Chip `SPD EEPROM’ (confidence: 8)

EEPROMs are *NOT* sensors! They are data storage chips commonly
found on memory modules (SPD), in monitors (EDID), or in some
laptops, for example.

Driver `it87′ (should be inserted):
Detects correctly:
* ISA bus address 0×0290 (Busdriver `i2c-isa’)
Chip `ITE IT8705F Super IO Sensors’ (confidence: 9)

I will now generate the commands needed to load the required modules.
Just press ENTER to continue: ENTER

To make the sensors modules behave correctly, add these lines to
/etc/modules:

#—-cut here—-
# I2C adapter drivers
i2c-viapro
# Chip drivers
lm90
eeprom
it87
#—-cut here—-

#上面的内容是关键,列举了启动时要载入的模块,检测结果和我在Windows下用EVEREST Ultimate软件查得到主板的情况一致:VIA KT400的芯片组和传感器ITE IT8705F, National LM90 (ISA 290h, SMBus 4Ch),如果上述检测未能找到出你主板上的传感器,查看/usr/share/doc/lm-sensors/doc/lm_sensors- FAQ.html 或者去lm-sensors wiki:http://www.lm-sensors.org/wiki 查找解决方法.

Do you want to add these lines to /etc/modules automatically? (yes/NO)yes确认添加的模块:

sudo gedit /etc/modules

打开/etc/modules查看:

louis@Ubuntu-desktop:~$ sudo gedit /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with “#” are ignored.

fuse
lp

# Generated by sensors-detect on Sat May 19 22:57:41 2007
# I2C adapter drivers
i2c-viapro
# Chip drivers
lm90
eeprom
it87

第三步:安装其它监控软件xsensors,ksensors,gdesklets(gdesklets里有很多桌面小程序),Gkrellm,hddtemp等,自己选择安装.

sudo apt-get install xsensors或者ksensors(KDE中推荐使用ksensors)

sudo apt-get install gdesklets gkrellm

安装硬盘温度监控:

sudo apt-get install hddtemp

安装完后重启系统就能正确监控了.

终端中输入sensors命令或者用xsensors或者ksensors就可随时监控CPU温度,风扇转速等硬件状态.

louis@Ubuntu-desktop:~$ sensors
lm90-i2c-0-4c
Adapter: SMBus Via Pro adapter at 0400
M/B Temp: +37°C (low = +0°C, high = +70°C)
CPU Temp: +45.0°C (low = +0.0°C, high = +70.0°C)
M/B Crit: +85°C (hyst = +75°C)
CPU Crit: +75°C (hyst = +65°C)

it87-isa-0290
Adapter: ISA adapter
VCore 1: +1.50 V (min = +0.00 V, max = +4.08 V)
VCore 2: +2.53 V (min = +0.00 V, max = +4.08 V)
+3.3V: +3.33 V (min = +0.00 V, max = +4.08 V)
+5V: +4.92 V (min = +0.00 V, max = +6.85 V)
+12V: +11.97 V (min = +0.00 V, max = +16.32 V)
-12V: -19.75 V (min = -27.36 V, max = +3.93 V)
-5V: -0.62 V (min = -13.64 V, max = +4.03 V)
Stdby: +3.87 V (min = +0.00 V, max = +6.85 V)
VBat: +2.03 V
fan1: 3013 RPM (min = 2008 RPM, div = 8)
fan2: 0 RPM (min = 0 RPM, div = 8)
M/B Temp: +42°C (low = +127°C, high = +65°C) sensor = thermistor
CPU Temp: -55°C (low = -1°C, high = +127°C) sensor = thermistor
Temp3: -20°C (low = -1°C, high = +127°C) sensor = thermistor

显示结果中有些数值是不正确的,但是硬件实际的工作状态可能是正常的,只是显示问题.无效的项或者错误的项可以进行修改.

sudo gedit /etc/sensors.conf

使用新立得软件包在Ubuntu 9.04下安装配置LAMP服务器

Posted By 思爱 on 2009年10月16日

打开新立得,编辑 –> 使用任务分组标记软件包 –> 勾选 LAMP Server
即可。

手动分别安装,可以如下:

1. 升级现有软件包

sudo apt-get upgdate

sudo apt-get dist-upgrade

2. 安装mysql

sudo apt-get install mysql-server

安装过程中会叫你输入root用户密码,并确认。

3. 安装apache2

sudo apt-get install apache2

4. 安装php5

sudo apt-get install php5

5. 安装php的mysql模块

sudo apt-get install php5-mysql

6. 安装php的gd库

sudo apt-get install php5-gd

7. 安装libapache2-mod-auth-mysql

sudo apt-get install libapache2-mod-auth-mysql

8. 安装apache的可加载PHP解析器 libapache2-mod-php5

sudo apt-get install libapache2-mod-php5

9. 安装phpmyadmin

sudo apt-get install phpmyadmin

cd /var/www

sudo ln -s /usr/share/phpmyadmin

apache2文件主要存在于目录/usr/lib/apache2/modules目录下
php存在于/usr/lib/php5目录下,但它是可以通过apache2来支持的脚本语言,通过apache2中装载模块来实现运行并解析php文件的。
mysql安装于目录/usr/share/mysql目录下。另外,
执行文件
/usr/bin/mysql

数据库
/var/lib/mysql

/var/log/mysql

控制文件(可以用来更改数据库的路径)
/etc/mysql/my.cnf

可以通过http://xxx.xx.xxx.xxx/index.html来查看WEB服务器中的apache2是否已经正确,显示It works !

产生的启动和停止文件是:/etc/init.d/apache2
启动:sudo apache2ctl -k start
停止:sudo apache2ctl -k stop
重新启动:sudo apache2ctl -k restart

2)首先是配置PHP,其实默认的配置已经很好了,这里主要是让它显示中文
修改 /etc/php5/apache2/php.ini
找到 #default_charset = “iso-8859-1″
去掉#并把它改成 default_charset=”gb2312″
这里的意思是让中文成为默认的字符

3)然后是配置apache ,让apache支持PHP

修改/etc/apache2/mods-enabled/php5.load去掉前的#,即表示装载此模块库LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

修改 /etc/apache2/mods-enabled/php5.conf
找到 #AddType application/x-httpd-php .php
把前面的 # 号去掉

修改/etc/apache2/mods-enabled/dir.conf
找到 DirectoryIndex
在其后面添加 index.php

修改/etc/apache2/conf.d/charset
为了更好的显示中文,找一下 AddDefaultCharset
把它前面的 #号去了,后面改成 GB2312
也就是 AddDefaultCharset GB2312

而以上四步中,前三步在安装过程中都已经配置完成了,即装好后就已经不需要设置了。
另外,如果还需要配置一些内容,可以参考目录/etc/apache2/mods-enabled/下的配置文件,
ubuntu中的apache2已经装配置文件分散到了多个文件内。
例如:主目录定义在etc/apache2/sites-enabled/000-default文件内,一般是/var/www/
虚拟别名定义在/etc/apache2/mods-enabled/alias.conf文件内
端口定义在文件/etc/apache2/ports.conf

另外,还需要说明的两组目录是:mods-available和mods-enabled后者是前者的链式文件目录
sites-enabled是sites-available的链式文件目录
而平时经常用到的httpd.conf文件却为空了。

在/var/www/目录下建立一个文件default.php,并写上一句:< ?php phpinfo() ?>,再在浏览器中运行,
即可查看apache2对php是否已经可以解析了。

4)配置mysql,并在php中调用
修改/etc/php5/apache2/php.ini中的extension=myql.so,去掉前面的分号,重启,即取得对数据库的支持
在连接数据库时,出现:Fatal error: Call to undefined function mysql_connect() 解决办法
是要安装php5-mysql数据库模块,可以通过新立得包管理器安装。

Openfire无法登录后台的解决方法

Posted By 思爱 on 2009年10月10日

今天比较郁闷,安装完openfire登录管理控制台居然提示:

Login failed:make sure your username and password are correct and that you’re an admin or moderator

解决方案如下: (仅限使用mysql的帅哥使用)

关闭openfire服务,就是从其控制台stop然后再start,再用安装时指定的用户名密码登陆即可
默认是用户名:admin,密码:admin

让MySQL取消反查域名

Posted By 思爱 on 2009年10月10日

连接MySQL速度慢的解决方法.

PHP远程连接MYSQL速度慢,有时远程连接到MYSQL用时4-20秒不等, 本地连接MYSQL正常,出现这种问题的主要原因是,默认安装的 MYSQL开启了DNS的反向解析,在MY.CNF(UNIX或LINUX系统下)或MY.INI(WINDOWS系统下)文件的[mysqld]下加入 skip-name-resolve这一句。

在局域网内连接其他机器的MYSQL,发现速度慢的很,不知道什么原因,总有几秒的延迟.

后来在网上发现解决方法,my.cnf里面添加

[mysqld]

skip-name-resolve

skip-grant-tables

这样速度就快了!

skip-name-resolve

选项就能禁用DNS解析,连接速度会快很多。不过,这样的话就不能在MySQL的授权表中使用主机名了而只能用ip格式。

若使用–skip-grant-tables系统将对任何用户的访问不做任何访问控制,但可以用 mysqladmin flush-privileges或mysqladmin reload来开启访问控制;默认情况是show databases语句对所有用户开放,

如果mysql服务器没有开远程帐户,就在my.cnf里面加上skip-grant-tables

Ubuntu下更改MySQL数据库存储位置

Posted By 思爱 on 2009年10月10日

MySQL数据库的文件结构是怎么样的呢,对于这样子创建的数据库命令:

CREATE DATABASE mysqldb

在默认的数据库存储位置下就会有个文件夹mysqldb。要操作数据库首先得停止数据库进程:

$sudo /etc/init.d/mysql stop

本文以转移到/home/mysql这个位置为例,下面命令将原有数据库转移到新位置(保留原权限属性):

$sudo cp –R –p /var/lib/mysql /home/mysql

编辑MySQL配置文件:

$gksu gedit /etc/mysql/my.cnf

在 gedit中找到datadir这一行,将后面等于号之后的内容更改为/home/mysql然后保存退出。自Ubuntu 7.10开始,

Ubuntu就开始使用一种安全软件叫做AppArmor,这个安全软件会在你的文件系统中创建一个允许应用程序访问的区域(专业术语:应 用程序访问控制)。如果不为MySQL修改AppArmor配置文件,永远也无法为新设置的数据库存储位置启动

数据库服务。配置AppArmor:

$sudo nano /etc/apparmor.d/usr.sbin.mysqld

在gedit中找到/var/lib/mysql/这两行,注释掉这两行,在这两行前分别添加一个符号“#”即可注释,在这两行之前或

之后加上下面内容:

/home/mysql/ r,
/home/mysql/** rwk,

保存后退出,执行命令:

$sudo /etc/init.d/apparmor reload

返回Reloading AppArmor profiles : done.即可以重启MySQL服务:

$sudo /etc/init.d/mysql start

至此MySQL数据库存储位置就更改完毕了。

FAQ:

Q:当我运行$sudo /etc/init.d/apparmor reload却返回信息

Skipping profile /etc/apparmor.d/usr.sbin.mysqld~
: Warning.

并且也无法启动MySQL服务,怎么办呢?

A:出 现这个问题可能是因为你使用了$sudo gedit或$gksu gedit这样子的命令来编辑usr.sbin.mysqld这个配置文件的,这两个图形界面文本编辑器会在相同位置生成一个 usr.sbin.mysqld~的文件,从而影响了AppArmor读取配置文件,出现这个问题先删除这个usr.sbin.mysqld~文件:

$sudo rm /etc/apparmor.d/usr.sbin.mysqld~

然后使用$sudo nano这个终端文本编辑器来编辑配置文件即可。

最省钱的极品Godaddy优惠码

Posted By 思爱 on 2009年10月4日

优惠码很多,我只推荐几个现在仍有效的,最最优惠的促销码。(注意:优惠码随时失效,请看清金额再付款)

BTPS7 – $50以上折价20%

catalog1 – $75以上减价$20  (相当于26.7%, 2009年3月18日测试有效

gdp1015r : $125以上优惠30%  (目前最大折扣, 2009年3月18日测试有效)

cjchost - 虚拟主机折价20%

geekssl12 – 购买SSL认证$12.99

cjcdollar – 减价$1  (适合用来续费独立IP,相当于1/2.99=33.4% , 2009年3月18日测试有效 )

Wallet30 .com优惠30%

cjcunlmtd – 虚拟主机Unlimited PlanDeluxe Plan更便宜,看图:
20090509_a41d1b3c1a75e190d253YAfnI8fLRj9g