阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS 7系统安装Ghost博客平台

103次阅读
没有评论

共计 3190 个字符,预计需要花费 8 分钟才能阅读完成。

一、Ghost 介绍

Ghost 是一个开源、免费的博客平台,它基于 Node.js 构建,设计目标是简化在线发布博客的过程。
本文主要讲述怎样在 CentOS 7 上安装 Ghost。

二、安装过程

1、首先确保所有的系统包为最新

# yum -y update

2、安装 LAMP 服务器

安装基本的 LAMP 环境是必须的,LAMP 是指 Linux、Apache、MariaDB、PHP。

1)安装 Apache 服务器

# yum install httpd openssl mod_ssl

重启 Apache 服务器

# systemctl restart httpd
# systemctl status httpd
# systemctl enable httpd

2)安装 MariaDB 数据库

# yum install mariadb mariadb-server mysql

默认情况下,MariaDB 并不够安全,故应该修改其默认配置来加固其安全。使用 mysql_secure_installation 脚本,并注意以下的步骤细节,比如设置 root 账户的密码、移除匿名用户、不允许 root 账户远程登录、移除 test 数据库和时序安全访问 MariaDB 等。

# mysql_secure_installation

像这样进行配置:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

下一步需要登录到 MariaDB 控制台并为 WikkaWiki 创建一个数据库。运行以下命令:

# mysql -u root -p    

重启 MariaDB

# systemctl restart mariadb
# systemctl status mariadb
# systemctl enable mariadb

3)安装 PHP

# yum install php php-mysql

如果 PHP 应用还需要一些扩展模块,可以选择安装,如下:

php-bcmath          : A module for PHP applications for using the bcmath library
php-cli             : Command-line interface for PHP
php-common          : Common files for PHP
php-dba             : A database abstraction layer module for PHP applications
php-devel           : Files needed for building PHP extensions
php-embedded        : PHP library for embedding in applications
php-enchant         : Enchant spelling extension for PHP applications
php-fpm             : PHP FastCGI Process Manager
php-gd              : A module for PHP applications for using the gd graphics library
php-intl            : Internationalization extension for PHP applications
php-ldap            : A module for PHP applications that use LDAP
php-mbstring        : A module for PHP applications which need multi-byte string handling
php-mysql           : A module for PHP applications that use MySQL databases
php-mysqlnd         : A module for PHP applications that use MySQL databases
php-odbc            : A module for PHP applications that use ODBC databases
php-pdo             : A database access abstraction module for PHP applications
php-pear.noarch     : PHP Extension and Application Repository framework
php-pecl-memcache   : Extension to work with the Memcached caching daemon
php-pgsql           : A PostgreSQL database module for PHP
php-process         : Modules for PHP script using system process interfaces
php-pspell          : A module for PHP applications for using pspell interfaces
php-recode          : A module for PHP applications for using the recode library
php-snmp            : A module for PHP applications that query SNMP-managed devices
php-soap            : A module for PHP applications that use the SOAP protocol
php-xml             : A module for PHP applications which use XML
php-xmlrpc          : A module for PHP applications which use the XML-RPC protocol

4)配置防火墙

CentOS 7 的防火墙默认会阻塞一切,故必须在防火墙允许 HTTP/HTTPS 通过防火墙。执行命令:

# sudo firewall-cmd --permanent --zone=public --add-service=http
# sudo firewall-cmd --permanent --zone=public --add-service=https
# sudo firewall-cmd --reload

3、安装 Node.js 和 npm

运行以下命令安装 Node.js 和 npm:

# yum install nodejs npm --enablerepo=epel

验证安装是否正确,执行:

# node -v && npm -v
v0.10.26
1.3.6

4、安装 Ghost

下载并解压 Ghost:

# mkdir -p /var/www/html
# cd /var/www/html
# curl -L -O https://ghost.org/zip/ghost-latest.zip  
# unzip -d ghost ghost-latest.zip  
# cd ghost
# sudo npm install --production

Ghost 安装完成后,进行配置并用主机的域名更新配置文件中的 URL。

# cp config.example.js config.js

打开配置文件:

# nano config.js

找到“Production”节,用域名更新 URL,修改后看起来如下:

// ### Production
    // When running Ghost in the wild, use the production environment.
    // Configure your URL and mail settings here
    production: {
        url: 'http://your_domain',

至此完成了整个安装过程,可以启动 Ghost 了。

# npm start –production

三、访问 Ghost

Ghost 默认在 HTTP 80 端口下是可用的。所以打开浏览器,访问 http://server-ip:2368,完成剩余的安装步骤。如果主机上使用了防火墙,需要允许 2368 端口通过。

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2016-10/136410.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计3190字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中