CentOS 6.4 安装配置心得

为DSMS系统配置了一个测试环境,装的CentOS 6.4,有些心得记录如下:

1、和Debian相比,CentOS的SELinux很恶心,配置后需要开启一些规则才能正常工作,一不小心就死活无法正常工作

2、yum类似apt,可以网络升级、安装,和Debian类似,如果需要一些特殊的包,需要用非官方的源,比如FFMPEG,最常用的是RPMREPO:

http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

Edit /etc/yum.repos.d/rpmforge.repo to enable extras for newer version, such as subversion.

3、Install Java

http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-6-on-fedora-centos-red-hat-rhel/

http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/

4、SELinux相关

/etc/sysconfig/iptables,注意文件中配置的顺序,别弄错地方了

SAMBA配置之后,需要setsebool -P samba_enable_home_dirs on

HTTPD配置了代理,需要setsebool -P httpd_can_network_connect true

5、其他

服务:service httpd start

启动:chkconfig –list 和 chkconfig httpd on

 

Linux 下分区后生成 /dev/ 下的设备

简述:

fdisk分区后不会主动通知内核设备重新分区过,一般说来,重启之后就可以识别到新分区的设备文件了,但重启很麻烦。

Linux下通常用partprobe工具通知内核,大多数发行版都使用udev管理设备文件,一般说来会自动生成设备文件的。

在我们板子上:

1、运行fdisk分区

2、通知内核: hdparm -z /your/block/device/such/as/dev/sda

3、生成设备文件:我们板子用mdev管理设备文件,因此:mdev -s

 

Compile QT 4.8.0 with MinGW

OS: Windows 7 (x64, EN)

I use zip packages because I wanna know what has been done clearly.

 

MinGW

As recommended by the official site of MinGW, I use mingw-get-0.4-mingw32-alpha-1-bin.tar.xz for my installation.

1. Extract all files to D:ToolsMinGW.

2. "Control Pannel" ==> "System" ==> "Advanced System Settings" ==> "Environment Variables", Add "D:ToolsMinGWbin" to "PATH".

3. cmd.

copy D:ToolsMinGWvarlibmingw-getdatadefaults.xml D:ToolsMinGWvarlibmingw-getdataprofile.xml
mingw-get update
mingw-get install binutils gcc g++ gdb gmp libiconv mingw32-make mpfr pthreads-w32

Which will install the following packages to D:ToolsMinGW.

binutils-2.22-1-mingw32-bin.tar.lzma
binutils-2.22-1-mingw32-doc.tar.lzma
binutils-2.22-1-mingw32-lang.tar.lzma
gcc-4.6.2-1-mingw32-doc.tar.lzma
gcc-4.6.2-1-mingw32-lang.tar.lzma
gcc-4.6.2-1-mingw32-lic.tar.lzma
gcc-c++-4.6.2-1-mingw32-bin.tar.lzma
gcc-core-4.6.2-1-mingw32-bin.tar.lzma
gdb-7.3.1-1-mingw32-bin.tar.lzma
gdb-7.3.1-1-mingw32-doc.tar.lzma
gmp-5.0.1-1-mingw32-dev.tar.lzma
gmp-5.0.1-1-mingw32-doc.tar.lzma
gmp-5.0.1-1-mingw32-lic.tar.lzma
libexpat-2.0.1-1-mingw32-dll-1.tar.gz
libgcc-4.6.2-1-mingw32-dll-1.tar.lzma
libgmp-5.0.1-1-mingw32-dll-10.tar.lzma
libgmpxx-5.0.1-1-mingw32-dll-4.tar.lzma
libgomp-4.6.2-1-mingw32-dll-1.tar.lzma
libiconv-1.14-2-mingw32-bin.tar.lzma
libiconv-1.14-2-mingw32-dev.tar.lzma
libiconv-1.14-2-mingw32-dll-2.tar.lzma
libiconv-1.14-2-mingw32-doc.tar.lzma
libiconv-1.14-2-mingw32-lic.tar.lzma
libintl-0.18.1.1-2-mingw32-dll-8.tar.lzma
libmpc-0.8.1-1-mingw32-dll-2.tar.lzma
libmpfr-2.4.1-1-mingw32-dll-1.tar.lzma
libpthreadgc-2.9.0-mingw32-pre-20110507-2-dll-2.tar.lzma
libquadmath-4.6.2-1-mingw32-dll-0.tar.lzma
libssp-4.6.2-1-mingw32-dll-0.tar.lzma
libstdc++-4.6.2-1-mingw32-dll-6.tar.lzma
make-3.82-5-mingw32-bin.tar.lzma
make-3.82-5-mingw32-doc.tar.lzma
make-3.82-5-mingw32-lang.tar.lzma
mingwrt-3.20-mingw32-dev.tar.gz
mingwrt-3.20-mingw32-dll.tar.gz
mpfr-2.4.1-1-mingw32-dev.tar.lzma
mpfr-2.4.1-1-mingw32-doc.tar.lzma
mpfr-2.4.1-1-mingw32-lic.tar.lzma
pthreads-w32-2.9.0-mingw32-pre-20110507-2-dev.tar.lzma
pthreads-w32-2.9.0-mingw32-pre-20110507-2-doc.tar.lzma
pthreads-w32-2.9.0-mingw32-pre-20110507-2-lic.tar.lzma
w32api-3.17-2-mingw32-dev.tar.lzma

 

Perl

Also recommended by the official site, download: http://strawberryperl.com/download/5.12.3.0/strawberry-perl-5.12.3.0-64bit.zip

Extract to D:ToolsPerl.

Same as MinGW, expand "PATH Environment Variables" with "D:ToolsPerlperlbin;D:ToolsPerlperlsitebin".

 

QT

1. Download qt-everywhere-opensource-src-4.8.0.tar.gz and extract to "D:QTqt-4.8.0-gcc-4.6". NOTE: Don't use "g++" in the name, it will cause copy error.

2. Configure:

According to http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler/, I wanna to reduce size of binary files.

Edit D:QTqt-4.8.0-gcc-4.6mkspecswin32-g++qmake.conf, with

QMAKE_CFLAGS_RELEASE = -Os -momit-leaf-frame-pointer

Open cmd, and configure:

cd D:QTqt-4.8.0-gcc-4.6
configure -release -opensource -developer-build -shared -ltcg -no-fast -exceptions -accessibility -stl -opengl desktop -no-openvg -platform win32-g++-4.6 -graphicssystem raster -qt-zlib -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -incredibuild-xge -plugin-manifests -qmake -process -rtti -mmx -3dnow -sse -sse2 -no-openssl -no-dbus -no-phonon -phonon-backend -multimedia -audio-backend -webkit -script -scripttools -declarative -declarative-debug -no-directwrite -arch windows -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -qt-style-plastique -qt-style-cleanlooks -qt-style-motif -qt-style-cde -qt-style-windowsce -qt-style-windowsmobile -qt-style-s60 -native-gestures -no-s60 -saveconfig 2012_01_02

NOTICE:

I disable database, ssl, directwrite, DirectX, etc. because they require header files or binary libraries out side of qt package. Also, there's a bug for OpenGL, so I disable OpenGL options. (https://bugreports.qt.nokia.com/browse/QTBUG-17997). In fact, OpenGL in the official QT SDK doesn't work on my box at all. 😦

And I use "-saveconfig 2012_01_02" to save my configuration.

This step requires perl installation which has been done before (syncqt).

3. Make:

Run and wait:

mingw32-make

Wish it works for you.

Use PuTTY to Access Windows Command Console (CMD)

Summary

I use WinSSHD to supply SSH service on Windows and PuTTY to connect. It works as well as "cmd".

I also tried Windows Telnet Service from Microsoft, but it doesn't work well.

 

Features of the default "cmd.exe" / "command.exe" of Windows is limited. I wanna a better console tool.

But either PuTTY or Mintty can't work well:

http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/win-command-prompt.html

http://code.google.com/p/mintty/issues/detail?id=234

 

1. PuTTY as CMD console

I use WinSSHD as a SSH server for Windows. http://www.bitvise.com/winsshd.html, Pernal edition is free of charge by non-commercial personal users. And PuTTY connects to the SSH server.

It works as well as in "cmd.exe". I haven't find any better solution till now.

NOTE:

To make "HOME", "END" and "DEL" key working, configure PuTTY: "Terminal" ==> "Keyboard" ==>

The Backspace key: Control-? (127)
The Home and End keys: Standard
The Function keys and keypad: SCO

 

2. Cygwin Terminal

(1). In fact, Mintty supplied by the latest Cygwin installation works very well.

(2). Project puttycyg patches original PuTTY to do that. http://code.google.com/p/puttycyg/

(3). You can also use the official way to do that, which compiles a "exe" for cygwin and simlate a telnet connection: http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/cygwin-terminal-window.html

 

3. Mintty as MSYS Terminal

mingw-get install msys-mintty
D:ToolsMinGWmsys1.0msys.bat -mintty

In my installation, MinGW has been installed to D:ToolsMinGW.

Use .htaccess File for Apache HTTPD Authentication on Windows

Installation of Apache can be found here: Install WAMP (Windows-Apache-MySQL-PHP) with ZIP packages – (5)

Here is a simple example for sharing files to others with authentication by Apache HTTPD on Windows.

Folder to share is D:ToolsApachehtdocsshare

1. Update httpd.conf

In <Directory "D:ToolsApachehtdocs"> session, update "AllowOverride None" to "AllowOverride AuthConfig" or "AllowOverride All".

2. Create password file

Run the following command: (If you have never create such a password file, such as D:ToolsApacheconfpasswd.txt, then use "-c" option.)

D:ToolsApachebinhtpassword -c -b D:ToolsApacheconfpasswd.txt user_for_share passwd_for_share

If the password file exists, use "-c" option will overwrite it.

D:ToolsApachebinhtpassword -b D:ToolsApacheconfpasswd.txt user_for_share2 passwd_for_share2

3. Create .htaccess file

D:ToolsApachehtdocsshare.htaccess

AuthType Basic
AuthName "My Share for Restricted Access"
AuthUserFile D:/Tools/Apache/conf/passwd.txt
Require valid-user

If you wanna require a specific user for "share" folder, then use "Require user user_for_share" insted of "Require valid-user".

4. Test

Restart Apache service, and then open http://localhost/share/. It will require your authentication now.

Install WAMP (Windows-Apache-MySQL-PHP) with ZIP packages – (5)

The article is one of a series articles, for more information, please have a look at: Install WAMP (Windows-Apache-MySQL-PHP) with ZIP packages – (1)

phpMyAdmin & WordPress

phpMyAdmin

1. Download and extract

Extract phpMyAdmin-3.4.9-all-languages.zip to D:\Tools\Apache\htdocs\phpMyAdmin

2. Login

Open http://localhost/phpmyadmin/, and login with root and its password.

3. Create user and password for wordpress

Skipped.

I’ll show you how to use command line to do such things:

mysql -h localhost -u root -p
CREATE USER 'username_here'@'localhost' IDENTIFIED BY 'password_here';
CREATE USER 'username_here'@'%' IDENTIFIED BY 'password_here';
CREATE DATABASE database_name_here;
GRANT ALL PRIVILEGES ON database_name_here.* TO 'username_here'@'localhost' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON database_name_here.* TO 'username_here'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
QUIT

WordPress

1. Download and extract

Extract wordpress-3.3.zip to D:\Tools\Apache\htdocs\wordpress

2. Edit configuration file

Copy D:\Tools\Apache\htdocs\wordpress\wp-config-sample.php to D:\Tools\Apache\htdocs\wordpress\wp-config.php

Update ‘database_name_here’, ‘username_here’, and ‘password_here’ for wordpress database.

3. Configure

Open http://localhost/wordpress/ to continue.

Install WAMP (Windows-Apache-MySQL-PHP) with ZIP packages – (4)

The article is one of a series articles, for more information, please have a look at: Install WAMP (Windows-Apache-MySQL-PHP) with ZIP packages – (1)

PHP

Download 5.2.17 “VC6 x86 Thread Safe” http://windows.php.net/download/. We use “VC6 x86 Thread Safe” binary for Apache, “Non Thread Safe” should be used with IIS.

1. Extract

Extract all files of php-5.2.17-Win32-VC6-x86.zip to D:\Tools\PHP

2. Environment Variable

Right click on “My Computer”, Properties -> Advanced -> Environment Variable -> Path of “System variables”. And then append

;D:\Tools\PHP

to the end.

3. Configuration file

a) copy D:\Tools\PHP\php.ini-recommended to D:\Tools\PHP\php.ini

b) Update extension_dir

extension_dir = "./"

to

extension_dir = "ext"

c) Un-comment some of “extension=…” lines.

extension=php_bz2.dll
extension=php_curl.dll
extension=php_dba.dll
extension=php_dbase.dll
extension=php_fdf.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
;extension=php_ifx.dll
extension=php_imap.dll
extension=php_interbase.dll
extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mcrypt.dll
extension=php_mhash.dll
extension=php_mime_magic.dll
extension=php_ming.dll
extension=php_msql.dll
extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
extension=php_openssl.dll
extension=php_pdo.dll
extension=php_pdo_firebird.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
extension=php_pspell.dll
extension=php_shmop.dll
extension=php_snmp.dll
extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite.dll
;extension=php_sybase_ct.dll
extension=php_tidy.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll
extension=php_zip.dll

4. Update Apache Configuration

a) Edit D:\Tools\Apache\conf\httpd.conf, add the following lines to the last

#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "D:/Tools/PHP/"
LoadModule php5_module "D:/Tools/PHP/php5apache2_2.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

b) Change line

DirectoryIndex index.html

to

DirectoryIndex index.html index.php

c) Edit D:\Tools\Apache\conf\mime.types, add the following two lines

application/x-httpd-php				php
application/x-httpd-php-source			phps

5. Restart Apache Service

D:\Tools\Apache\bin\httpd.exe -k restart

6. Test

Edit D:\Tools\Apache\htdocs\index.php

<?php
phpinfo();
?>

Open http://localhost/index.php