OSSN全称Open Source Social Network,它是使用PHP开发的开源的社交网站。
Opensource-Socialnetwork (OSSN) is a social networking software written in PHP. It allows you to make a social networking website and helps your members build social relationships, with people who share similar professional or personal interests.
OSSN源代码:https://github.com/opensource-socialnetwork/opensource-socialnetwork
Ubuntu安装OSSN
安装Apache:
$ sudo apt-get install apache2
开启rewrite模块:
$ sudo a2enmod rewrite
$ sudo service apache2 restart
安装MySQL,在Ubuntu 16.04上安装MySQL:
$ sudo apt install mysql-server mysql-client
在安装过程中需要你输入MySQL 管理员用户(root)密码,然后运行MySQL初始化安全脚本:
$ sudo mysql_secure_installation
根据提示信息设置,mysql_secure_installation脚本设置的东西:更改root密码、移除MySQL的匿名用户、禁止root远程登录、删除test数据库。使用上面的这些选项可以提高MySQL的安全。
创建数据库和数据库用户:
$ mysql -u root -p
mysql> SET GLOBAL sql_mode='';
mysql> CREATE DATABASE ossndb;
mysql> CREATE USER 'ossn_user'@'localhost' IDENTIFIED BY 'your_password';
mysql> GRANT ALL PRIVILEGES ON ossndb.* TO 'ossn_user'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit
安装PHP:
$ sudo apt-get install php libapache2-mod-php php-cli php-common php-json php-mcrypt php-mysql php-xml php-curl php-zip php-gd
重启Apache:
$ sudo service apache2 restart
下载OSSN源码:https://www.opensource-socialnetwork.org/download
$ cd /tmp
$ wget https://www.opensource-socialnetwork.org/downloads/ossn-v4.2-1468404691.zip -O ossn.zip
$ sudo unzip ossn.zip -d /var/www/html/
配置PHP:
$ sudo vim /etc/php/7.0/cli/php.ini
allow_url_fopen = On
file_uploads = On
upload_max_filesize = 32M
OSSN需要一个目录存放用户上传的图像:
$ sudo mkdir -p /var/www/html/ossn_data
更改目录权限:
$ sudo chown www-data:www-data -R /var/www/html/
创建Apache虚拟主机配置文件:
$ sudo vim /etc/apache2/sites-available/ossn.conf
<VirtualHost *:80>
ServerAdmin your_email@xxx.com
DocumentRoot /var/www/html/ossn/
ServerName your_domain.com
ServerAlias www.your_domain.com
<Directory /var/www/html/ossn/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/ossn-error.log
CustomLog /var/log/apache2/ossn-access.log common
</VirtualHost>
注意替换域名。
使生效:
$ sudo ln -s /etc/apache2/sites-available/ossn.conf /etc/apache2/sites-enabled/ossn.conf
$ sudo service apache2 restart
使用浏览器访问:http://your_domain.com
设置数据库连接和数据目录:
创建管理员用户:
完成安装: