Super Linux server

1、开机启动项配置:
root@iZj6cjcwx7sfb0vurxqanbZ:/etc/init.d# update-rc.d -f apache2 remove
Removing any system startup links for /etc/init.d/apache2 …
/etc/rc0.d/K09apache2
/etc/rc1.d/K09apache2
/etc/rc2.d/S91apache2
/etc/rc3.d/S91apache2
/etc/rc4.d/S91apache2
/etc/rc5.d/S91apache2
/etc/rc6.d/K09apache2
root@iZj6cjcwx7sfb0vurxqanbZ:/etc/init.d# update-rc.d -f apache2 defaults
Adding system startup for /etc/init.d/apache2 …
/etc/rc0.d/K20apache2 -> ../init.d/apache2
/etc/rc1.d/K20apache2 -> ../init.d/apache2
/etc/rc6.d/K20apache2 -> ../init.d/apache2
/etc/rc2.d/S20apache2 -> ../init.d/apache2
/etc/rc3.d/S20apache2 -> ../init.d/apache2
/etc/rc4.d/S20apache2 -> ../init.d/apache2
/etc/rc5.d/S20apache2 -> ../init.d/apache2
root@iZj6cjcwx7sfb0vurxqanbZ:/etc/init.d# ls /etc/rc0.d/
K10unattended-upgrades K19rng-tools K20agentwatch K20aliyun-rdate K20apache2 K20im K20nscd K20redis-server K20rsync K20supervisor K20xl2tpd K84ipsec README S20sendsigs S30urandom S31umountnfs.sh S40umountfs S60umountroot S90halt
root@iZj6cjcwx7sfb0vurxqanbZ:/etc/init.d# exit

2、 WordPress index.php 重写
搭建好lamp环境之后,如果你需要使用apache的url重写功能,需要配置文件中启用apache的Rewrite模块:
1.如果是sudo apt-get install lamp-server^方式搭建的开发环境:
在终端中执行
sudo a2enmod rewrite
1
指令后,即启用了 Mod_rewrite 模块。

另外,也可以通过将 /etc/apache2/mods-available/rewrite.load 连接到 /etc/apache2/mods-enabled/rewrite.load 来打开 Mod_rewrite 模块。用指令操作就是:
sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
1
2.如果是源码编译安装的lamp环境:

修改配置文件:/usr/local/apache/conf/httpd.conf

打开LoadModule rewrite_module modules/mod_rewrite.so

即可。
之后重启apache服务即可。
root@iZj6cjcwx7sfb0vurxqanbZ:/var/www/beststudywow/coder# cat .htaccess

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress
root@iZj6cjcwx7sfb0vurxqanbZ:/var/www/beststudywow/coder#

3 、SVN 服务器 配置

* 运行环境:ubuntu 14.04 64位

首先,官方教程是必须的:
https://help.ubuntu.com/community/L2TPServer

没有安照这个做过了就先不要到处百度“如何部署L2TP”之类的了。先参阅Official Ubuntu Documentation。

主要的问题出在:
sudo ipsec verify
这一步。因为官方要求是得到一个没有任何错误的反馈。
在第一次测试的时候我出现了2个[FAILED],具体情况如下:

Checking your system to see if IPsec got installed and started correctly:
Version check and ipsec on-path [OK] Linux Openswan U2.6.38/K3.13.0-52-generic (netkey)
Checking for IPsec support in kernel [OK] SAref kernel support [N/A] NETKEY: Testing XFRM related proc values [FAILED]

Please disable /proc/sys/net/ipv4/conf/*/send_redirects
or NETKEY will cause the sending of bogus ICMP redirects!

[FAILED]

Please disable /proc/sys/net/ipv4/conf/*/accept_redirects
or NETKEY will accept bogus ICMP redirects!

[OK] Hardware RNG detected, testing if used properly [FAILED]

Hardware RNG is present but ‘rngd’ or ‘clrngd’ is not running.
No harware random used!

Checking that pluto is running [OK] Pluto listening for IKE on udp 500 [OK] Pluto listening for NAT-T on udp 4500 [OK] Checking for ‘ip’ command [OK] Checking /bin/sh is not /bin/dash [WARNING] Checking for ‘iptables’ command [OK] Opportunistic Encryption Support [DISABLED]

我们先解决:
NETKEY: Testing XFRM related proc values [FAILED] 解决方案:在命令行里黏贴以下命令
for each in /proc/sys/net/ipv4/conf/*
> do
> echo 0 > $each/accept_redirects
> echo 0 > $each/send_redirects
> done

然后解决:
Hardware RNG detected, testing if used properly [FAILED]

Hardware RNG is present but ‘rngd’ or ‘clrngd’ is not running.
No harware random used!
解决方案:
sudo apt-get install rng-tools

* echo 0 > /proc/sys/net/ipv4/ip_forward
* ipsec verify

2236 vi /etc/apache2/mods-enabled/dav_svn.conf
70
71 DAV svn
72 SVNParentPath /var/www/svn/
73 AuthType Basic
74 AuthName “Subversion Repository”
75 AuthUserFile /etc/apache2/dav_svn.passwd
76 AuthzSVNAccessFile /etc/apache2/dav_svn.authz
77 Require valid-user
78

2238 vim /etc/apache2/dav_svn.authz
1 [groups] 2 admin=svnuser
3 [repos:/] 4 *=
5 @admin=rw

2323 sudo chown -R www-data:subversion xuezhe
2324 sudo chmod -R g+rws xuezhe

1. Apache切换php 版本

sudo a2dismod php5
sudo a2enmod php7.0
root@iZj6cjcwx7sfb0vurxqanbZ:/var/www/beststudywow/moodle# sudo apt-get install php7.0-xml
root@iZj6cjcwx7sfb0vurxqanbZ:/var/www/beststudywow/moodle# sudo service apache2 restart

1.导入软件源的公钥
sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv EA312927
1
2.为mongodb创建软件源list文件

ubuntu12.04
echo “deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.2 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
1
ubuntu14.04
echo “deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
1
ubuntu16.04
echo “deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
1
3.更新软件源并安装mongodb
sudo apt-get update
sudo apt-get install -y mongodb-org
1
2
如果想要安装特定的版本,使用下面命令:
sudo apt-get install -y mongodb-org=3.2.9 mongodb-org-server=3.2.9 mongodb-org-shell=3.2.9 mongodb-org-mongos=3.2.9 mongodb-org-tools=3.2.9
1

Next ArticlePython 正则 处理网页