分类: 系统运维
2015-01-06 14:53:38
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config ; chkconfig iptables off ; /etc/init.d/iptables stop ; chkconfig sendmail off ; /usr/sbin/ntpdate ntp.api.bz
init 6
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libmcrypt libmcrypt-* gd gd-devel pcre pcre-* libxslt* mhash*
tar zxvf mysql-5.5.3-m3.tar.gz
useradd -s /sbin/nologin mysql
cd mysql-5.5.3-m3
./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=gbk,gb2312,utf8 --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-ssl --with-embedded-server --enable-local-infile --with-plugins=all --with-mysqld-ldflags=-all-static --with-mysqld-user=mysql
make && make install
cp support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
bin/mysql_install_db --user=mysql
chown -R root.mysql . ; chown -R mysql var
ll
/usr/local/mysql/bin/mysqld_safe --user=mysql &
netstat -tnl|grep 3306
bin/mysqladmin version
bin/mysqladmin variables
bin/mysql -u root
mysql>
delete from mysql.user where host='localhost' and user='';
flush privileges;
set password for 'root'@'localhost'=password('123456');
cd /usr/local/src/mysql-5.5.3-m3
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chown root.root /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
chkconfig --list mysqld
/etc/init.d/mysqld start
/usr/local/mysql/bin/mysql -u root -p
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
cd /usr/local/mysql/libexec
cp mysqld mysqld.old
strip mysqld
vi /etc/rc.d/init.d/mysqld
添加下面两句
#chkconfig --add mysqld
#chkconfig --level 345 mysqld on
service mysqld restart
ln -s /usr/local/mysql/bin/* /sbin/
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
tar zxvf mysql-cluster-gpl-7.2.5-linux2.6-x86_64.tar.gz
mv mysql-cluster-gpl-7.2.5-linux2.6-x86_64 /usr/local/mysql
cd /usr/local/mysql
useradd -s /sbin/nologin mysql
chown -R mysql:mysql .
chown -R mysql:mysql -R data/
./scripts/mysql_install_db --user=mysql
./bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chown root.root /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
/etc/init.d/mysqld restart
Shutting down MySQL... [ OK ]
Starting MySQL.. [ OK ]
ln -s /usr/local/mysql/bin/mysql /sbin/mysql;ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin;ln -s /usr/local/mysql/bin/mysqldump /sbin/mysqldump
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
wget
tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local/libiconv
make && make install
wget
tar zxf php-5.4.8.tar.gz
cd php-5.4.8
./configure --prefix=/usr/local/php --with-fpm-user=www --with-fpm-group=www --enable-fpm --with-zlib --with-bz2 --enable-calendar --with-curl --enable-dba --with-libxml-dir --enable-ftp --with-gd --with-jpeg-dir --with-iconv=/usr/local/libiconv --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-mhash --enable-mbstring --with-mcrypt --enable-pcntl --enable-xml --disable-rpath --enable-shmop --enable-sockets --enable-zip --enable-bcmath --enable-soap --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-production /usr/local/php/etc/php.ini
cp php.ini-production /usr/local/php/lib/php.ini
cd /usr/local/php/bin/
wget
./pecl install mongo
wget
./pecl install redis
chown www:www -R /usr/local/php
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/src/php-5.4.8/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
/etc/init.d/php-fpm start
echo "/etc/init.d/php-fpm start" >> /etc/rc.local
netstat -tanp | grep php
wget
tar zxvf nginx-1.2.4.tar.gz
cd nginx-1.2.4
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-pcre --with-rtsig_module --with-select_module --with-debug --with-mail --with-mail_ssl_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_addition_module --with-http_realip_module --with-http_xslt_module --with-http_image_filter_module --with-http_sub_module
make && make install
cd /usr/local/nginx/conf/ ; cp nginx.conf nginx.conf.bak
vim nginx.conf
user www www;
worker_processes 8;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 9000;
}
http {
include mime.types;
default_type application/octet-stream;
charset utf-8;
client_header_buffer_size 128k;
large_client_header_buffers 8 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_intercept_errors off;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
autoindex on;
#gzip on;
include vhost/*.conf;
}
[root@F2C vhost]# more index.conf
server
{
listen 80;
server_name 118.26.232.242;
charset utf-8;
index index.html index.htm index.php;
root /var/www/html;
location / {
index index.html index.php;
try_files $uri $uri/ /index.php?s=$uri&$args;
}
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
}
chown www:www -R /usr/local/nginx
ll /usr/local/nginx
4. 启动测试
每次修改完配置文件后,都记得执行下面的命令测试配置文件正确性:
[root@imysql ~]# /etc/init.d/nginx configtest
导入数据库:
CREATE DATABASE `databases` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
grant ALL privileges on databases.* to 'username'@'localhost' identified by 'passwd123';
flush privileges;
数据库账户授权
mysql> grant ALL privileges on databases.* to 'user'@'localhost' identified by 'passwd';