安装准备:
1.服务器最低配置1核1GB RAM 需要IPv6 (Debian 8)
2.Apache 2
3.MySQL
4.PHP 5.6 推荐 ,PHP7 不支持
5.Memcached
6.NexusPHP SourceForge原版: https://sourceforge.net/projects/nexusphp/
科普
Memcache 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载。它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高了网站访问的速度。 MemCaChe是一个存储键值对的HashMap,在内存中对任意的数据(比如字符串、对象等)所使用的key-value存储,数据可以来自数据库调用、API调用,或者页面渲染的结果。MemCache设计理念就是小而强大,它简单的设计促进了快速部署、易于开发并解决面对大规模的数据缓存的许多难题,而所开放的API使得MemCache能用于Java、C/C++/C#、Perl、Python、PHP、Ruby等大部分流行的程序语言。
NexusPHP: 这是NexusPHP由来自浙江大学的Nexus团队发起并开发完成。它的目标是代替TBSource项目,提供一个完整的、有序的、重视用户信誉和知识的资源分享社区的解决方案。
这是一个比较老的BT开源项目,2010年开源的。
安装LAMP (Apache/MySQL/PHP)
安装Apache:
Apache 是一个开源软件,它目前运行在全球超过 50% 的服务器上.
首先,对你的源进行更新:
$ sudo apt-get install vim chkconfig $ sudo apt-get update $ sudo apt-get install apache2
安装完成后可以在浏览器地址栏输入 http://localhost/ 或者 IP地址,安装成功会有一个 It works 页面。
可以通过以下命令找到你的服务器的 IP 地址:
$ sudo ifconfig eth0 | grep inet | awk '{ print $2 }'
安装 MySQL:
MySQL是用于组织和检索数据的广泛部署的数据库管理系统。
$ sudo apt-get mysql-server libmysqlclient-dev
在安装过程中,MySQL 要求你设置一个 root 密码,不过你要是忘了设置,也可以在安装之后通过 MySQL shell 设置。
安装完成 MySQL 后你需要进行 MySQL 的初始设置,利用以下命令: # mysql_secure_installation 这步会要求你的 root 密码。 Enter current password for root (enter for none): OK, successfully used password, moving on...
之后会提示你是否想修改 root 密码,输入 N 不修改,Enter 进入下一步。
之后的步骤全部 Yes ,最后 MySQL 会重载使得设置完成,如下:
By 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...
完成以上步骤后你就可以开始安装 PHP。
安装 PHP
PHP 是种开源的 Web 脚本语言,并被广泛应用来制作动态网页。
添加PPA
$ sudo apt-get install python-software-properties software-properties-common $ sudo add-apt-repository ppa:ondrej/php $ sudo apt-get update
安装 PHP (Debian 7 以下):
# apt-get install php5 php-pear php5-suhosin php5-mysql
安装 PHP (Debian 7 or Higher):
# apt-get install php5 php-pear php5-mysql php5-gd php5.6-gd php5.6-mysql php5.6-common php5.6-curl php5.6-cli php5.6-mcrypt php5.6-mbstring php5.6-dom
接下来将会有两次询问,全部 yes 即可。
配置PHP5.6
打开php.ini配置文件:
$ vim /etc/php/5.6/fpm/php.ini display_errors = on
完成 PHP 安装后,重载 Apache:
# service apache2 restart
恭喜!你已经成功安装 LAMP!
测试LAMP
虽然我们已经安装了 LAMP ,但我们还是需要更直观一点查看安装成功的 LAMP。
首先创建一个文件:
# vim /var/www/info.php
在新文件写下:
<?php phpinfo(); ?>
之后 :wq 保存退出。
现在你可以在浏览器中输入 http://localhost/info.php 查看 PHP 版本等信息.
安装Memcached
安装memcached服务及php扩展
apt-get install memcached php5-memcached php5-memcache
修改配置文件
# vim /etc/memcached.conf 这里只需修改两个参数, 一是指定memcached所能使用的内存大小,如下: -m 256 #默认是64M,请修改成实际所需要的大小 256M即可 二是修改监听的IP地址,默认时memcached只监听在127.0.0.1这个本地回环地址上,如下修改成本地网卡接口上的实际IP: -l 127.0.0.1 #不修改 # 修改完重启 # service memcached restart
查看是否安装好memcached服务
ps aux | grep memcached
可以发现安装完memcached是自动启动了的。也可以如下命令查看:
# netstat -tap | grep 'memcached' # ss -tnl | grep 11211 LISTEN 0 128 172.31.11.96:11211 *:*
使用命令 telnet localhost 11211 来连接memcache实例, 输入stats 验证
导入数据库
NexusPHP 文件夹里面有一个 dbstructure.sql 数据库文件
Adminer: https://www.adminer.org/
推荐使用 Adminer 导入数据库,比phpMyAdmin 好用.
等待导入完成.
配置NexusPHP
编辑网站目录里面的 config/allconfig.php 文件
# vim /var/www/html/config/allconfig.php # chmod -R 777 config
找到以下部分:
$BASIC=array( 'SITENAME' => 'NexusPHP', #这是站名 'BASEURL' => 'localhost', #填写设置解析之后的域名 'announce_url' => 'localhost/announce.php', #localhost填网站域名 'mysql_host' => 'localhost', #数据库IP,填127.0.0.1比localhost好 'mysql_user' => 'root', #填数据库用户名 'mysql_pass' => 'nexusphprocks', #填数据库密码 'mysql_db' => 'nexusphp', #填数据库名称 );
配置好就可以访问了
NexusPHP FAQ
NexusPHP 不显示验证码
PHP没有安装图片处理扩展(GD库), 使用下面命令即可安装
# apt-get install php5-gd
MySQL 内存表The table 'pvlogs' is full
在Mysql 里面执行命令, 详细解释
set global max_heap_table_size=1048576000 set global max_heap_table_size=1048576000
原文 (在 Debian 下安装 Apache,MySQL,PHP)
原文 (Linux+nginx+mysql+php实战nexusPHP)
推荐 ([Linux] 簡易搭建NexusPHP PT站)
原文 (Memcached)
原文 (Memcached)
原文 (MYSQL)