首页 >>  正文

centos7安装服务器版

来源:baiyundou.net   日期:2024-09-25

作者:虹銷-雨霽

前言

       因工作需要,近期一直在研究LimeSurvey的部署安装。作为一个小白,在安装过程中,遇到了不少问题,也查阅了各种教程,无奈网上的各种教程要么涵盖不全,要么版本老旧,对新手不是很友好。本着我为人人,人人为我的分享精神,趁着正式部署的机会,收集了素材,把我的安装过程记录下来,方便以后自己查阅,也为各位同好提供参考。本教程旨在为初学者提供帮助,把我遇到的各种问题予以呈现并给出解决办法,难免啰嗦,希望各位大佬不要见笑。第一次发文,不妥之处也请大家多多指教。

       本文参考了一下文章,对原作者表示感谢。

       http://www.vue5.com/centos/22971.html

       https://www.cnblogs.com/it-tsz/p/13211464.html

       https://www.cnblogs.com/w-j-q/p/14995398.html

LimeSurve简介

       LimeSurvey(前身为PHPSurveyor)是一款在线问卷调查程序,它用PHP语言编写并可以使用MySQL,PostgreSQL或者MSSQL等多种数据库,同时它也是一个开源软件,其最新版本的软件包可以完全免费获取和使用。它集成了调查程序开发、问卷的设计、修改、发布、回收和统计等多项功能,使用它,用户不必了解这些功能的编程细节。 

       LimeSurve官方网站:https://www.limesurvey.org/

LimeSurve部署安装教程 

       本教程基于CentOS 7.6系统,其他版本可做参考。

       本教程假定在一个全新的CentOS系统中进行部署安装,需要安装Mariadb数据库和PHP,如已安装可跳过这两个步骤。

       本教程命令需在“root”账户下运行,如果不是,可使用“su”命令提权,或者在命令前添加“sudo”以获取root权限。

       首先更新系统版本。

yum clean all

yum -y update

    (一)安装Mariadb

       1、安装Mariadb

       通过yum安装mariadb-server,默认依赖安装mariadb,一个是服务端、一个是客户端。

yum install mariadb-server

       出现如下提示时,输入“y”,等待安装完成。

Install  1 Package (+9 Dependent packages)

Total download size: 21 M

Installed size: 110 M

Is this ok [y/d/N]: y

       2、配置Mariadb

       1)安装完成后首先要把MariaDB服务开启,并设置为开机启动。

systemctl start mariadb

systemctl enable mariadb

      出现如下提示时,表示设置成功。

Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to  /usr/lib/systemd/system/mariadb.service.

       2)首次安装需要进行数据库的配置。

mysql_secure_installatio

       3)配置出现的各个选项。

Enter current password for root (enter fornone):      # 输入数据库root密码(注意不是系统root密码),第一次安装还没有设置密码,直接回车即可

Set root password? [Y/n]         # 设置密码,y

New password:       # 输入您的新密码

Re-enter new password:       # 再次输入密码

Remove anonymous users? [Y/n]       # 移除匿名用户, y

Disallow root login remotely? [Y/n]       # 拒绝root远程登录,y

Remove test database and access to it?[Y/n]       # 删除test数据库,y

Reload privilege tables now? [Y/n]       # 重新加载权限表,y

       4)测试是否能够登录成功

mysql -u root -p

Enter password:     # 输入数据库root密码

       出现  MariaDB [(none)]> 就表示已经能够正常登录使用MariaDB数据库了。

Welcome to the MariaDB monitor.  Commands end with ; or g.

Your MariaDB connection id is 8

Server version: 5.5.60-MariaDB MariaDBServer

Copyright (c) 2000, 2018, Oracle, MariaDBCorporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' toclear the current input statement.

MariaDB [(none)]>

       5)登录到数据库服务器后,需要创建一个LimeSurvey安装数据库。

CREATE DATABASE limesurvey_db;        #创建名为limesurvey_db的数据库

GRANT ALL PRIVILEGES on limesurvey_db.* to 'root'@'localhost' identified by 'YourPassword';         # "YourPassword"更改为您的数据库root密码

FLUSH PRIVILEGES;

exit

    (二)安装PHP7

       本文写作时,LimeSurve最新版本是5.3.32,需要 PHP 7.2.5 或更高版本。

      1、更改yum源

       CentOS的yum源不存在php7.x,我们首先要更改yum源。

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

       如果出现以下错误,需要配置dns。

 //curl: (6) Could not resolve host: mirror.webtatic.com; Unknown error

//error: skipping https://mirror.webtatic.com/yum/el7/webtatic-release.rpm - transfer failed

       1)打开文件/etc/resolv.conf:

vi /etc/resolv.conf

       2)输入“i”添加以下内容:

nameserver 8.8.8.8

       3)输入“:wq”保存并退出编辑。

       4)重启网卡。

systemctl restart network

       2、安装PHP7

       1)查看目前能够安装的PHP版本

yum list php*

       可以看到可安装的PHP最新版为:php72w。

       2)安装php72w

yum -y install php72w

       3)安装拓展

yum install php72w-common php72w-fpm php72w-opcache php72w-gd php72w-mysqlnd php72w-mbstring php72w-pecl-redis php72w-pecl-memcached php72w-devel

       上述命令一共会安装30个拓展包,安装过程较慢,请耐心等待。

       安装的拓展包如下:

php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib

       4)查看PHP版本

php -v

       显示如下信息,说明php72w开发环境基本安装完成。

PHP 7.2.34 (cli) (built: Oct  1 2020 13:37:37) ( NTS )

Copyright (c) 1997-2018 The PHP Group

Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

    with Zend OPcache v7.2.34, Copyright (c) 1999-2018, by Zend Technologies

       5)重启httpd服务,并设置为开机启动。

systemctl restart httpd.service

systemctl enable httpd.service

       出现如下提示时,表示设置成功。

Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

       6)安装httpd服务

       如果执行重启httpd服务出现以下提示,说明没有安装httpd服务。

Failed to restart httpd.service: Unit notfound.

       如果没有安装,则执行下面命令进行安装。

yum install httpd -y

       启动httpd服务,并设置为开机启动。

systemctl start httpd.service

systemctl enable httpd.service

    (三)安装LimeSurvey

       1、下载最新版LimeSurvey

       首先要做的是去LimeSurvey的下载页面,查看最新的稳定版本的LimeSurvey CE的下载链接,并使用wget命令下载。

       LimeSurvey下载页面:https://community.limesurvey.org/downloads/

wget https://download.limesurvey.org/latest-stable-release/limesurvey5.3.32+220817.zip     #加粗文字可换为最新的下载链接

       将LimeSurvey存档解压缩到服务器上的文档根目录。

unzip limesurvey5.3.32+220817.zip     #加粗文字需更换为下载的实际文件名 

       如果提示以下内容,说明未安装uzip。

-bash: uzip: command not found

       安装uzip。

yum install unzip

       移动limesurvey文件夹。

mv limesurvey /var/www/html/

       更改文件夹权限。

chown apache:apache -R /var/www/html/limesurvey/

       2、配置Apache Web服务器

       为您的LimeSurvey网站创建Apache虚拟主机。首先使用文本编辑器创建"/etc/httpd/conf.d/vhosts.conf"文件。

vi /etc/httpd/conf.d/vhosts.conf

       输入以下内容:

IncludeOptional vhosts.d/*.conf

       保存并关闭文件。接下来,创建虚拟主机。

mkdir /etc/httpd/vhosts.d/

vi /etc/httpd/vhosts.d/yourdomain.com.conf     #“yourdomain.com”更换为您的域名

       输入以下内容:

ServerAdmin [email protected]

DocumentRoot /var/www/html/limesurvey/

ServerName www.yourdomain.com     #“www.yourdomain.com”更换为您的域名

ErrorLog /var/log/httpd/www.yourdomain.com -error_log     #“www.yourdomain.com”更换为您的域名

CustomLog /var/log/httpd/www.yourdomain.com -access_log combined     #“www.yourdomain.com”更换为您的域名


DirectoryIndex index.html index.php

Options FollowSymLinks

AllowOverride All

Require all granted

       保存并关闭文件。重新启动apache服务以使更改生效:

systemctl restart httpd.service

       3、安装LimeSurvey

      在浏览器中输入您的域名或者IP地址,开始安装LimeSurvey。

       4、可能会出现的问题

       安装到第3步,有可能会报错,无法继续安装,如图所示:

       

       需要修改php.ini及php.conf两个文件:

vi /etc/php.ini

       找到session.save_path,删除前面的注释符“;”,路径改为“/tmp”,如图所示:

vi /etc/httpd/conf.d/php.conf

       找到session.save_path,路径改为“/tmp”,如图所示:

       保存并关闭文件。重新启动apache服务以使更改生效:

systemctl restart httpd.service  

       在浏览器中输入您的域名或者IP地址,重新开始安装LimeSurvey。(重要)

       如果还是报错,可能需要使用“reboot”命令重启系统后重试。

总结

       第一次发文,难免有疏漏之处,希望大家多批评指正。希望能对学习研究的朋友有所帮助。

   

","force_purephv":"0","gnid":"938b52228c91e49bb","img_data":[{"flag":2,"img":[{"desc":"","height":"505","title":"","url":"https://p0.ssl.img.360kuai.com/t012e3e5496b2cb9fab.jpg","width":"600"},{"desc":"","height":"288","title":"","url":"https://p0.ssl.img.360kuai.com/t017cd9968782931bbe.jpg","width":"600"},{"desc":"","height":"288","title":"","url":"https://p0.ssl.img.360kuai.com/t01b0d7760cfbc856e9.jpg","width":"600"},{"desc":"","height":"522","title":"","url":"https://p0.ssl.img.360kuai.com/t01675c9fde03793ad6.jpg","width":"600"},{"desc":"","height":"520","title":"","url":"https://p0.ssl.img.360kuai.com/t017e2c0a884c36bcf4.jpg","width":"600"},{"desc":"","height":"288","title":"","url":"https://p0.ssl.img.360kuai.com/t013a2ed0c00ae4b5fa.jpg","width":"600"},{"desc":"","height":"509","title":"","url":"https://p0.ssl.img.360kuai.com/t01a74c56c8b93d9c83.jpg","width":"600"},{"desc":"","height":"288","title":"","url":"https://p0.ssl.img.360kuai.com/t014a6122d0f7dabad4.jpg","width":"600"},{"desc":"","height":"288","title":"","url":"https://p0.ssl.img.360kuai.com/t01de83b08cbd25c5a1.jpg","width":"600"},{"desc":"","height":"299","title":"","url":"https://p0.ssl.img.360kuai.com/t01fa38f5f1536955db.jpg","width":"554"}]}],"original":0,"pat":"art_src_1,fts0,sts0","powerby":"cache","pub_time":1663049763000,"pure":"","rawurl":"http://zm.news.so.com/4f0b377c4a40e964d5b0fcb4643d630b","redirect":0,"rptid":"2a9bb61c286197d5","s":"t","src":"什么值得买","tag":[],"title":"从零开始,在CentOS 7上部署安装LimeSurvey

鬱盆符696centos7怎么安装 centos7安装步骤 -
仇勤周18411782838 ______ 这里为已经光盘引导启动,进入centos7安装选项: Install Centos7 安装centos7 Test this media & install CentOS 7 测试安装文件并安装 Troubleshooting 故障修复 2 我选择的是第一项,进入下面的界面,选择中文,点击继续,或者选...

鬱盆符696linuxcentos7中怎么搭建php服务器 -
仇勤周18411782838 ______ linuxcentos7中搭建php服务器方法详见:http://jingyan.baidu.com/article/76a7e409f8e670fc3b6e15c9.html

鬱盆符696如何重新安装centos 7 系统 -
仇勤周18411782838 ______ 说明:截止目前CentOS 7.x最新版本为CentOS 7.0,下面介绍CentOS 7.0的具体安装配置过程 服务器相关设置如下:操作系统:CentOS 7.0 64位 IP地址:192.168.21.128 网关:192.168.21.2 DNS:8.8.8.8 8.8.4.4 备注:生产服务器如果是大内...

鬱盆符696怎么安装centos7php环境服务器 -
仇勤周18411782838 ______ 在控制台下,输入su,回车,输入密码,此时输入密码是看不到 的,输完回车就行,然后输入yum list php*回车就能看到和php有关的安装包,选择一个你想要的php版本,然后输入yum install phpxxx,php就被安装到本机上了,mysql也是这么安装的,但是apache的名字要用httpd来安装,php安装以后默认只有最基础的扩展,还要在安装其他的扩展,如yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

鬱盆符696如何在 CentOS 7 上安装 Percona Server -
仇勤周18411782838 ______ 1、安装数据库源 # yum install percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm1 2、安装Percona 5.7 # yum install Percona-Server-server-571 3、启动数据库并设置开机启动 # service mysqld restart # ...

鬱盆符696安装centos7怎么选择服务器版 -
仇勤周18411782838 ______ 安装过程中随便选,需要什么以后可以再装

鬱盆符696centos7开机启动服务怎么添加 -
仇勤周18411782838 ______ 在开机时启用一个服务:systemctl enable 服务器名.service 在开机时禁用一个服务:systemctl disable 服务器名.service

鬱盆符696centos7 怎么把服务设为开机启动 -
仇勤周18411782838 ______ 一、安装CentOS7.1服务器开机,设成光驱启动,成功引导系统后界面说明:InstallCentOS7//安装CentOS7Testthismedia&installCentOS7//测试安装文件并安装CentOS7Troubleshooting//修复故障这里选择第一项,安装CentOS7,回车,进入下...

鬱盆符696centos7怎么安装nginx -
仇勤周18411782838 ______ 安装环境为:最小化安装的centos7,关闭seliunx.最小化安装centos:关闭selinux sed –i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config 开始安装nginx1.7.8 创建群组 groupadd www 创建一个用户,不允许登陆和不创主目录 ...

鬱盆符696如何在CentOS 7服务器上安装NodeJS -
仇勤周18411782838 ______ CentOS 7 上安装 Redis 服务器的方法 1、进入Redis官网获取Redis最新稳定版下载地址,通过wget命令下载 Redis 源代码. Redis编译 1、通过tar -xvf redis-3.0.2.tar.gz命令解压下载Redis源码压缩包redis-3.0.2.tar.gz; 2、编译Redis.通过cd ...

(编辑:自媒体)
关于我们 | 客户服务 | 服务条款 | 联系我们 | 免责声明 | 网站地图 @ 白云都 2024