root +密码 用 ssh 登陆

  • 安装screen

  • yum install screen

  • screen -S lnmp   //创建会话

  • screen -r lnmp   //重新连接后查看进程

  • 重装OS后Terminal的key验证失败,删除本地  User/.ssh/known_hosts即可



安装DirectAdmin



  • yum -y update

  • yum -y install unzip lftp tar quota yum -y install gcc gcc-c++ flex make perl gd automake wget flex   /// 安装unzip,安装lftp,安装tar,安装quota,安装gcc 安装gcc-c++,安装flex,安装make 安装automake,安装perl,安装gd,安装wget,安装flex。

  • 可逐条分开安装(如果不嫌麻烦的话

  • 安装前及安装后的汉化参考:http://www.freehao123.com/directadmin/

  • yum remove httpd* php* mysql* -y    /// 移除php,移除mysql,所以要在安装lnmp之前完成。

  • wget http://directadmin.com/setup.sh

  • chmod +x setup.sh

  • ./setup.sh

  • 输入DA授权的CID与LID

  • 用二级域名设置

  • 选择可自定义安装的 Apache 版本与php5的版本,一般选择cgi(也就是suphp),不然权限问题会很困扰。

  • passwd admin    ///更改DA默认密码


 

安装完ip:2222不能访问,清除所有防火墙规则

  • iptables -F

  • iptables -X

  • iptables -Z


若提示 “ Unable to determine Usertype user.conf needs to be repaired” ,按照官方指引

  • userdel -r admin

  • cd /usr/local/directadmin/scripts

  • ./fix_da_user.sh admin user domain.com

  • service directadmin restart     //////重启DirectAdmin

  • yum clean all  ///清除


http://IP:2222  访问,用户名为admin

安装Zend (系统自带,要开启)



  • cd /usr/local/directadmin/custombuild

  • ./build set zend yes

  • ./build zend

  • service httpd restart    ///重启


安装ZendGuardLoader  (DA的php.ini默认写法是指向32位用的) ,以下方法适用php5.3



  • cd /usr/local/

  • mkdir -p /usr/local/ZendGuardLoader/     ----步骤重复,意思是在/usr/local 文件夹下建立一个zend文件夹

  • cd ZendGuardLoader

  • Linux 32位Zend Guard Loader 下载:

  • wget -c http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz

  • Linux 64位Zend Guard Loader 下载:

  • wget -c http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz

  • tar zxvf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz    ////64位用

  • mv ZendGuardLoader-php-5.3-linux-glibc23-x86_64 ZendGuardLoader    /////更名被解压的文件为ZendGuardLoader 好记一点

  • cp php-5.3.x/ZendGuardLoader.so /usr/local/ZendGuardLoader/ZendGuardLoader

  • 在DA后台直接编辑php.ini文件,添加下面内容,或者将本来的lib(CLI模式)文件命令注释掉亦可。          具体路径地址为: /usr/local/etc/php5/cgi/php.ini   ///64位,cgi 模式


[Zend Guard Loader]
zend_extension="/usr/local/zend/ZendGuardLoader.so"
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
service httpd restart    ///重启 ,查看探针。

安装Zend的主要纠结在于module的路径问题和Zend本身的路径问题,理清楚了就好

安装eAccelerator 0.9.6.1



  • cd /usr/local

  • mkdir -p eAccelerator      ////索性在local文件夹下创建 eAccelerator 文件夹

  • cd eAccelerator

  • wget http://downloads.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Feaccelerator%2Ffiles%2Feaccelerator%2FeAccelerator%25200.9.6.1%2F&ts=1333899657&use_mirror=ncu

  • tar -xvjf eaccelerator-0.9.6.1.tar.bz2

  • cd eaccelerator-0.9.6.1

  • export PHP_PREFIX="/usr/local"

  • $PHP_PREFIX/php5/bin/phpize

  • ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/php5/bin/php-config

  • make && make install

  • cd /tmp

  • mkdir eaccelerator

  • chmod 0777 eaccelerator


查看/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/ 这样的路径,记录号码串,编译时候要用

编译php.ini


[eaccelerator]
zend_extension="/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"
eaccelerator.shm_size="32"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
service httpd restart    ///重启httpd 并查看探针

将eAccelerator写入php.ini的时候要注意记录自己的no-debug-non-zts-20090626字符串,并替换写在手动安装的[Zend]和[ionCube Loader] 前面

安装ionCube


最重要的是找到ioncube_loader_lin_5.3.so的位置,比如我的就是在DA默认安装的/usr/local/lib/文件夹下,然后编译php.ini以下内容:
[ionCube Loader]
zend_extension="/usr/local/lib/ioncube_loader_lin_5.3.so"

安装Memcahed: (先搞清楚memcache和memcached的区别 - -! )



  • 需要libevent组件



  • rpm -qa|grep libevent    ///检查是否有安装

  • 如果有:

  • yum -y install libevent   ///升级

  • 如果没有:

  • cd /usr/local

  • mkdir libevent    ///在该目录下建立libevent文件夹

  • wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz   ///最新版在libevent.org找

  • tar -xvf libevent-2.0.21-stable.tar.gz    ///解压缩,注意,不是xvjf命令

  • cd libevent-2.0.21-stable     ///进入解压出来的目录

  • ./configure;make;make install;     ///需要gcc-等组件,一开始已装过

  • 检测libevent是否安装成功:

  • ls -al /usr/lib | grep libevent


… …

安装memcache: 参考1 ;  参考2  ;

安装memcached   参考1 ;  参考2 

对比自己的软件的官网版本,和各种路径,和上面一样在/usr/local/目录下建立相应的文件夹,进入后下载,编译即可。
因为 memcache与memcached是对整站以及集群站点的缓存,已经安装了eAccelerator就暂时不考虑了

 

以上三个插件的编译顺序为:[eaccelerator] 最先,[ionCube Loader]其次,[Memcached]其次(如果有), [Zend Guard Loader] 最后。先后之分,不然容易出现500等错误。
以上方法在MySQL 5.6下DA后台无法新建数据库,适用于5.5版

安装CSF防火墙 



  • yum install perl-libwww-perl perl iptables

  • cd /usr/local

  • mkdir iptables

  • cd iptables

  • wget http://www.configserver.com/free/csf.tgz

  • tar -xzf csf.tgz

  • cd csf

  • sh install.sh


测试:   perl /etc/csf/csftest.pl
在DA后台找到 ConfigServer Security & Firewall 里面有Firewall configuration可视化文件,将TESTING = 改成0即可

安装Awstats 



  • cd /usr/local/directadmin/scripts

  • ./awstats.sh

  • service httpd restart

  • DA后台中的站点统计能找到


若装了DA,就不用lnmp了。

wordpress后台直接安装需要密码,解决方案(DA默认用的是apache 服务器):

先上传wordpress程序

  • chown -R apache /home/hiingnet/domains/XXXXXX


更新组件:

  • 通过编辑/usr/local/directadmin/custombuild/options.conf 可以进行手动一些更新   (不建议)

  • 自动检查升级

  • /usr/local/directadmin/custombuild/build versions

  • /usr/local/directadmin/custombuild/build update

  • /usr/local/directadmin/custombuild/build update_versions

  • APC和xcache不装了,可能因为CLI的关系。不顾一切地享用CGI之后才知道丫耗内存,不过我想,如果我现在用的CLI,也会依然想用CGI一样的道理的,所以的结果就貌似我站在哪一头都是望着彼岸的。





安装LNMP


1.暂无。

2.http://lnmp.org/install.html   下载安装lnmp   及扩展

3.MySQL密码及phpmyadmin密码如果未设置就都是root,修改口令:
wget http://soft.vpser.net/lnmp/ext/reset_mysql_root_password.sh;sh reset_mysql_root_password.sh
cd 进入lnmp+版本号 目录

4.建立Pureftpd  : http://lnmp.org/faq/ftpserver.html
/usr/local/mysql/bin/mysql -V      ///显示MySQL版本
MySQL如果是5.5版本,需要执行命令修复
wget http://soft.vpser.net/lnmp/ext/fix_pureftpd_mysql55.sh && chmod +x fix_pureftpd_mysql55.sh && ./fix_pureftpd_mysql55.sh
通过 ip/ftp 地址访问,并设置用户,UID GID用户组全部设置www
5.添加主机   http://lnmp.org/faq/lnmp-vhost-add-howto.html

伪静态:安装的时候选择wordpress

  • vi /usr/local/nginx/conf/vhost/域名.conf     ///查看

  • vi /usr/local/nginx/conf/wordpress.conf      ///查看


后台连接出现404 :

  • echo 'rewrite /wp-admin$ $scheme://$host$uri/ permanent;' >> /usr/local/nginx/conf/wordpress.conf && /etc/init.d/nginx restart


6.修改phpmyadmin地址:

  • mv /home/wwwroot/default/phpmyadmin/ /home/wwwroot/default/XXXXX/


中间空一隔,目录地址不同,这是lnmp1.0版的目录地址
7.FTP 开放权限:

  • chmod -R 755 /home/wwwroot

  • chown -R www /home/wwwroot


8.重启

  • service proftpd restart     ///重启ftp

  • /etc/init.d/nginx restart ///重启nginx

  • /root/lnmp restart   ///重启lnmp


 

TODO:

  • 修改root

  • 架设vpn,要先联络打开TUN/TAP

  • directadmin  后台端口,连接ftp口令,需改善

  • 不影响php环境下安装NodeJS

  • 备份VPS