g++ is often necessary for building various packages. But It’s quite hard to install it in CentOS if you don’t know a simple thing: yum install g++ will not work here. yum install compat-g++and yum install gcc-g++ won’t give any result too. The only command for yum to install g++ on CentOS is the following:
yum install gcc-c++
You might also want to install it with some more useful packages. Then your command will be:
yum install gcc-c++ compat-gcc-32 compat-gcc-32-c++
ScratchPad
This blog simply records all I've learned for IT knowledge.
Friday, February 19, 2010
Wednesday, December 9, 2009
install django in centos 5
# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# yum -y install lighttpd lighttpd-fastcgi mysql-server
# /etc/init.d/lighttpd start
change port from 80 to 8080 if needed:
# vi /etc/lighttpd/lighttpd.conf
- start lighttpd when system starts up:
/sbin/chkconfig --level 235 lighttpd on
/etc/init.d/lighttpd start
- install postgresql server
yum install postgresql postgresql-server
yum install postgresql-python python-psycopg2
edited the /etc/yum.repos.d/CentOS-Base.repo and changed the gpgcheck=1 to gpgcheck=0
if you met some warning messages.
Verify the installation
>>> import psycopg2
>>> psycopg2.apilevel
'2.0'
- setup postgresql user:
/usr/sbin/adduser postgres
mkdir /home/postgres
cd /home/postgres
chown -R postgres postgres
- setup firewall
allow http(s) and other port (like 8080, 5432(postgre port))
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
service iptables restart
- install mysql
yum install mysql*
yum install MySQL*
- install MySQLdb
yum install python-devel*
yum groupinstall "MySQL Database"
- install gcc (needed by PIL)
yum install gcc
- install libjpeg
wget http://www.ijg.org/files/jpegsrc.v7.tar.gz
tar zxvf *.tar.gz
cd jpeg-6b/
./configure
make
sudo make install-lib
- install python-imaging
yum install python-imaging
- install PIL
wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz
tar zxvf Image*.gz
cd Image*
python setup.py install
if you have such errors:
_imagingtk.c:20:16: error: tk.h: No such file or directory
install tcl-devel and tk-devel by yum
if you have issue when uploading image, check
/usr/lib/python2.4/site-packages/django/forms/fields.py
- install django
- upgrade MySQLdb
+ install easy_install: yum install python-setuptools
+ download the source: http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz?use_mirror=softlayer
+ install the packeg:
* export PYTHON_EGG_CACHE=/var/cache/python-eggs
* mkdir /var/cache/python-eggs
* chmod 777 /var/cache/python-eggs
* python setup.py build
* python setup.py install
- initialization of mysql
+ mysqladmin -u root password "newpassword"
+ mysql -u root -p
+ mysql>create user 'alpha'@'localhost' identified by 'some_passwd';
+ mysql>grant all privileges on alpha.* to 'alpha'@'localhost' with grant option;
- install python-yaml
+ yum install python-yaml
- vi /etc/httpd/conf.d/python.conf
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings
SetEnv PYTHON_EGG_CACHE /var/cache/python-eggs
PythonOption django.root /alpha
PythonDebug On
PythonPath "['/var/www', '/var/www/alpha'] + sys.path"
PythonInterpreter alpha
or virtual host
ServerName xxx.com
ServerAdmin xxx.com
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings
SetEnv PYTHON_EGG_CACHE /var/cache/python-eggs
PythonOption django.root /fornia
PythonDebug On
PythonPath "['/var/www', '/var/www/fornia'] + sys.path"
PythonInterpreter fornia
- if not be able to connect to DB, try to disable SELinux
matplotlib in django: http://bitsofpy.blogspot.com/2009/07/matplotlib-in-django.html
- mysql & Chinese support
1. change /etc/my.conf like:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
default-character-set=utf8
default-collation=utf8_general_ci
2. set charset in the database
alter database da_name character set utf8
3. "show character set" to make sure.
- change VPS localtime:
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
# yum -y install lighttpd lighttpd-fastcgi mysql-server
# /etc/init.d/lighttpd start
change port from 80 to 8080 if needed:
# vi /etc/lighttpd/lighttpd.conf
- start lighttpd when system starts up:
/sbin/chkconfig --level 235 lighttpd on
/etc/init.d/lighttpd start
- install postgresql server
yum install postgresql postgresql-server
yum install postgresql-python python-psycopg2
edited the /etc/yum.repos.d/CentOS-Base.repo and changed the gpgcheck=1 to gpgcheck=0
if you met some warning messages.
Verify the installation
>>> import psycopg2
>>> psycopg2.apilevel
'2.0'
- setup postgresql user:
/usr/sbin/adduser postgres
mkdir /home/postgres
cd /home/postgres
chown -R postgres postgres
- setup firewall
allow http(s) and other port (like 8080, 5432(postgre port))
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
service iptables restart
- install mysql
yum install mysql*
yum install MySQL*
- install MySQLdb
yum install python-devel*
yum groupinstall "MySQL Database"
- install gcc (needed by PIL)
yum install gcc
- install libjpeg
wget http://www.ijg.org/files/jpegsrc.v7.tar.gz
tar zxvf *.tar.gz
cd jpeg-6b/
./configure
make
sudo make install-lib
- install python-imaging
yum install python-imaging
- install PIL
wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz
tar zxvf Image*.gz
cd Image*
python setup.py install
if you have such errors:
_imagingtk.c:20:16: error: tk.h: No such file or directory
install tcl-devel and tk-devel by yum
if you have issue when uploading image, check
/usr/lib/python2.4/site-packages/django/forms/fields.py
- install django
- upgrade MySQLdb
+ install easy_install: yum install python-setuptools
+ download the source: http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz?use_mirror=softlayer
+ install the packeg:
* export PYTHON_EGG_CACHE=/var/cache/python-eggs
* mkdir /var/cache/python-eggs
* chmod 777 /var/cache/python-eggs
* python setup.py build
* python setup.py install
- initialization of mysql
+ mysqladmin -u root password "newpassword"
+ mysql -u root -p
+ mysql>create user 'alpha'@'localhost' identified by 'some_passwd';
+ mysql>grant all privileges on alpha.* to 'alpha'@'localhost' with grant option;
- install python-yaml
+ yum install python-yaml
- vi /etc/httpd/conf.d/python.conf
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings
SetEnv PYTHON_EGG_CACHE /var/cache/python-eggs
PythonOption django.root /alpha
PythonDebug On
PythonPath "['/var/www', '/var/www/alpha'] + sys.path"
PythonInterpreter alpha
or virtual host
ServerName xxx.com
ServerAdmin xxx.com
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings
SetEnv PYTHON_EGG_CACHE /var/cache/python-eggs
PythonOption django.root /fornia
PythonDebug On
PythonPath "['/var/www', '/var/www/fornia'] + sys.path"
PythonInterpreter fornia
- if not be able to connect to DB, try to disable SELinux
matplotlib in django: http://bitsofpy.blogspot.com/2009/07/matplotlib-in-django.html
- mysql & Chinese support
1. change /etc/my.conf like:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
default-character-set=utf8
default-collation=utf8_general_ci
2. set charset in the database
alter database da_name character set utf8
3. "show character set" to make sure.
- change VPS localtime:
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
Saturday, October 10, 2009
LLMD
linux + lighttpd + mysql + django
1. install lighttpd
a. 執行升級 [RPMforge] 套件
rpm -Uvh ftp://fr2.rpmfind.net/linux/dag/redhat/el5/en/i386/dag/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
b. 使用yum安装lighttpd
yum install lighttpd lighttd-fastcgi
1. install lighttpd
a. 執行升級 [RPMforge] 套件
rpm -Uvh ftp://fr2.rpmfind.net/linux/dag/redhat/el5/en/i386/dag/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
b. 使用yum安装lighttpd
yum install lighttpd lighttd-fastcgi
Friday, October 24, 2008
You cannot log on over the network, and any operation that involves Active Directory causes the following error message:
Naming information cannot be located because:
The workstation driver is not installed.
Contact your system administrator to verify that your domain is properly configured and is currently online.
CAUSE
The Client for Microsoft Networks component is actually the Workstation service. If you remove this service, the Netlogon and RPC Locator services are also removed. When you reinstall the Client for Microsoft Networks component, the Netlogon and RPC Locator services are also reinstalled, but the Netlogon service is not configured to depend on the Server service when the computer starts.
RESOLUTION
Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 (http://support.microsoft.com/kb/322756/) How to back up and restore the registry in Windows
1. If you did not reinstall the Client for Microsoft Networks component, follow these steps to install it:
a. In SBS 2000, right-click My Network Places, and then click Properties. In SBS 2003, open Control Panel , and then double-click Network Connections.
b. Right-click the internal network connection, and then click Properties.
c. Click Install, click Client, and then click Add.
d. Click Client for Microsoft Networks, and then click OK.
e. Click OK in each dialog box until all networking properties are closed, and then restart the Small Business Server (SBS) 2000 server.
2. Log on to the computer. Ignore any warnings about services that cannot start. Start the Services tool.
3. Verify that the startup type for the RPC Locator service is set to Automatic, and then start the service.
4. Verify that the startup type for the Netlogon service is set to Automatic. Do not start the Netlogon service yet.
5. Configure the Netlogon service to depend on the Server service:
a. Start Registry Editor (Regedt32.exe).
b. Locate and then click the DependOnService value under the following key in the registry:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Netlogon
c. On the Edit menu, click Multi String, type LanmanServer on a line by itself, and then click OK.
d. Quit Registry Editor.
6. In the Services tool, start the Netlogon service.
7. Verify that you can use Active Directory by using a program such as Active Directory Users and Computers to view or modify Active Directory.
8. Restart the server.
9. If the server takes a long time to restart, or if you receive warnings that services cannot start, use the Services tool to verify that the Netlogon service is set to Automatic and has started. You may have to set the startup type two times.
The workstation driver is not installed.
Contact your system administrator to verify that your domain is properly configured and is currently online.
CAUSE
The Client for Microsoft Networks component is actually the Workstation service. If you remove this service, the Netlogon and RPC Locator services are also removed. When you reinstall the Client for Microsoft Networks component, the Netlogon and RPC Locator services are also reinstalled, but the Netlogon service is not configured to depend on the Server service when the computer starts.
RESOLUTION
Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 (http://support.microsoft.com/kb/322756/) How to back up and restore the registry in Windows
1. If you did not reinstall the Client for Microsoft Networks component, follow these steps to install it:
a. In SBS 2000, right-click My Network Places, and then click Properties. In SBS 2003, open Control Panel , and then double-click Network Connections.
b. Right-click the internal network connection, and then click Properties.
c. Click Install, click Client, and then click Add.
d. Click Client for Microsoft Networks, and then click OK.
e. Click OK in each dialog box until all networking properties are closed, and then restart the Small Business Server (SBS) 2000 server.
2. Log on to the computer. Ignore any warnings about services that cannot start. Start the Services tool.
3. Verify that the startup type for the RPC Locator service is set to Automatic, and then start the service.
4. Verify that the startup type for the Netlogon service is set to Automatic. Do not start the Netlogon service yet.
5. Configure the Netlogon service to depend on the Server service:
a. Start Registry Editor (Regedt32.exe).
b. Locate and then click the DependOnService value under the following key in the registry:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Netlogon
c. On the Edit menu, click Multi String, type LanmanServer on a line by itself, and then click OK.
d. Quit Registry Editor.
6. In the Services tool, start the Netlogon service.
7. Verify that you can use Active Directory by using a program such as Active Directory Users and Computers to view or modify Active Directory.
8. Restart the server.
9. If the server takes a long time to restart, or if you receive warnings that services cannot start, use the Services tool to verify that the Netlogon service is set to Automatic and has started. You may have to set the startup type two times.
Wednesday, October 8, 2008
alice bot on miranda IM
1. reference
http://en.wikipedia.org/wiki/SmarterChild
2. download miranda IM first
3. download the plugin
http://addons.miranda-im.org/details.php?action=viewfile&id=326
http://en.wikipedia.org/wiki/SmarterChild
2. download miranda IM first
3. download the plugin
http://addons.miranda-im.org/details.php?action=viewfile&id=326
Tuesday, September 9, 2008
incompatibility of win2k3 r2, win2k3 sp1, and win2k
Before you can introduce Windows Server 2003 domain controllers, you must prepare the forest and domains with the ADPrep utility.
* ADPrep /forestprep on the schema master in your Windows 2000 forest.
* ADPrep /domainprep on the Infrastructure Master in each AD domain.
ADPrep is located in the i386 directory of the Windows Server 2003 install media.
Note: In Windows Server 2003 R2, ADPrep is not located in the same folder as in the older Windows Server 2003 media, and instead you need to look for it in the second CD. You see, Windows Server 2003 R2 comes on two installation disks. Installation disk 1 contains a slip-streamed version of Windows Server 2003 with Service Pack 2 (SP2). Installation disk 2 contains the Windows Server 2003 R2 files.
The correct version of the ADPrep.exe tool for Windows Server 2003 R2 is 5.2.3790.2075.
You can find the R2 ADPrep tool in the following folder on the second CD:
drive:\CMPNENTS\R2\ADPREP\
Note, running adprep on the PDC should be good enough.
* ADPrep /forestprep on the schema master in your Windows 2000 forest.
* ADPrep /domainprep on the Infrastructure Master in each AD domain.
ADPrep is located in the i386 directory of the Windows Server 2003 install media.
Note: In Windows Server 2003 R2, ADPrep is not located in the same folder as in the older Windows Server 2003 media, and instead you need to look for it in the second CD. You see, Windows Server 2003 R2 comes on two installation disks. Installation disk 1 contains a slip-streamed version of Windows Server 2003 with Service Pack 2 (SP2). Installation disk 2 contains the Windows Server 2003 R2 files.
The correct version of the ADPrep.exe tool for Windows Server 2003 R2 is 5.2.3790.2075.
You can find the R2 ADPrep tool in the following folder on the second CD:
drive:\CMPNENTS\R2\ADPREP\
Note, running adprep on the PDC should be good enough.
Thursday, September 4, 2008
script for collecting sys info
#!/bin/sh
do_cmd_output() {
echo "$*"
$*
echo
}
do_file_output() {
for file; do
[ -f $file ] && do_cmd_output cat $file
done
}
oom_output() {
echo '======================================================================='
date
echo '======================================================================='
echo
do_file_output /proc/meminfo
do_cmd_output ps -Aww -o pid,ppid,pcpu,vsize,rss,majflt,tty,stat,wchan,command
do_cmd_output top -b -n 1
do_file_output /sys/block/sda/queue/stats
do_file_output /proc/nbt/0/icore_stats
do_file_output /proc/nbt/0/icore_dstats
do_file_output /proc/nbt/0/icore_mstats
}
while true
do
oom_output >> /var/log/oom_profile.log
sleep 30
done
do_cmd_output() {
echo "$*"
$*
echo
}
do_file_output() {
for file; do
[ -f $file ] && do_cmd_output cat $file
done
}
oom_output() {
echo '======================================================================='
date
echo '======================================================================='
echo
do_file_output /proc/meminfo
do_cmd_output ps -Aww -o pid,ppid,pcpu,vsize,rss,majflt,tty,stat,wchan,command
do_cmd_output top -b -n 1
do_file_output /sys/block/sda/queue/stats
do_file_output /proc/nbt/0/icore_stats
do_file_output /proc/nbt/0/icore_dstats
do_file_output /proc/nbt/0/icore_mstats
}
while true
do
oom_output >> /var/log/oom_profile.log
sleep 30
done
Subscribe to:
Posts (Atom)