windows上安装Putty
打开putty,连接服务器,设置服务器的IP和Port,默认是root,login as: rootpasswd: 你的密码
连接入服务器后,先安装apachesudo yum updatesudo yum install httpd
编译一下httpdvim /etc/httpd/conf/httpd.confKeepAlive Off
设置apache虚拟服务器vim /etc/httpd/conf.d/vhost.conf
建立网页路径目录和日志目录sudo mkdir -p /var/www/html/ sudo mkdir -p /var/www/logs/
安装mysql数据库sudo yum install mysql-server
设置mysql密码sudo /usr/bin/mysql_secure_installationEnter current password for root (enter for none): #键入你的密码然后出现OK, successfully used password, moving on...按照下面提示键入yBy default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL!
配置mysqlvim /etc/my.cnf修改以下几行提高效率max_connections = 3000 #数据库最大连接数max_connect_errors = 6000 #数据库最大错误连接数thread_cache_size = 300 #进程缓存query_cache_size = 64M #MyISAM引擎优化中缓存query_cache_limit = 4M #指定单个查询能够使用的缓冲区大小tmp_table_size = 256M #临时表大小key_buffer_size = 1024M #索引缓存大小read_rnd_buffer_size = 16M #随机读取缓存bulk_insert_buffer_size = 64M #插入缓存myisam_sort_buffer_size = 128M #MyISAM引擎排序缓存myisam_max_sort_file_size = 10G #重建索引最大允许的临时文件大小innodb_additional_mem_pool_size = 16M #InnoDB 存储的数据目录信息和其它内部数据结构的内存池大小innodb_buffer_pool_size = 1024M #InnoDB 存储缓存区大小
开启mysql服务器sudo service mysqld start设置apache服务器为开机自启动sudo chkconfig mysql on
安装phpsudo yum install php php-mysql重启apache服务器sudo service httpd restart
新建一个php文件,检查一下服务器是否安装完成?sudo nano /var/www/html/index.php添加以下几行然后再浏览器里打卡页面http://你的域名