首页 >>  正文

centos添加用户权限不够

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

作者:虹銷-雨霽

前言

       因工作需要,近期一直在研究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

乌诗狭3231centos 6.5 如何让普通用户有对“/usr/”有写的权限? -
伊琰宣18417678475 ______ 用root登录之后,使用 chmod命令给文件和文件夹赋予权限,方法如下:chmod o+w -R /usr 即可 让所有用户对 /usr 增加写权限.PS:o 代表 other的意思,即其他所有人+ 增加权限 - 减去权限-R 递归赋权,包括当前目录子文件夹的文件的权限一起...

乌诗狭3231centos普通用户如何使用root账户安装的软件? -
伊琰宣18417678475 ______ 增加同组用户与其他用户的可执行权限 以/sbin/mgetty文件为例,默认情况下该文件只有root用户具有可执行权限,当使用ls命令查看结果如下$ ls -l /sbin/mgetty-rwx------ 1 root root 94312 2006-08-21 /sbin/mgetty 此后可通过chmod命令增加其它用户的可执行权限$ sudo chmod a+x /sbin/mgetty$ ls -l /sbin/mgetty-rwx--x--x 1 root root 94312 2006-08-21 /sbin/mgetty 此操作后其它用户均具有该文件的执行权限

乌诗狭3231系统之家CentOS 6.6系统安装的具体步骤怎么办 -
伊琰宣18417678475 ______ 1、安装CentOS 6.6系统的计算机内存必须等于或者大于628M(最小内存628M),才能启用图形安装模式;2、CentOS 6.6的系统安装方式分为:图形安装模式和文本安装模式;3、CentOS 6.6文本安装模式不支持自定义分区,建议使用图形...

乌诗狭3231centos 6.4 如何为ftp创建用户 -
伊琰宣18417678475 ______ 既然对这个系统不熟悉,安全起见不要将FTP用户配置为系统用户. 推荐安装一个FTP服务器,用对应FTP服务来建立独立于系统的FTP用户. 这样操作除了安全考虑之外,还可以增加更方便的用户管理

乌诗狭3231centos下如何指定ftp用户访问全盘? -
伊琰宣18417678475 ______ 修改/etc/vsftpd/vsftpd.conf文件,添加:chroot_local_user=NO chroot_list_enable=NO 试一下.

乌诗狭3231CentOS系统下,怎样设置不同用户在某一天不同时间段的使用权限? -
伊琰宣18417678475 ______ root权限用crontab做任务计划,再特定的时间检查特定的用户,如果不在正确的时间,就强制让它退出.

乌诗狭3231linux怎样修改用户权限? -
伊琰宣18417678475 ______ 1. linux中更改用户权限和用户组可以使用chmod命令. 2. 增加权限给当前用户 chmod +wx filename. 命令中各选项的含义为:u 表示“用户(user)”,即文件或目录的所有者.g 表示“同组(group)用户”,即与文件属主有相同组ID的所有用户.o 表示“其他(others)用户”.a 表示“所有(all)用户”.它是系统默认值.

乌诗狭3231如何设置权限用户 -
伊琰宣18417678475 ______ 方法/步骤因为雅雅本人用的是WIN7,所以这里就以WIN7为例,XP系统方法也一样,只不过具体设置位置不同.第一步,新建标准一个标准用户.win7对账户控制这一方面做的非常的细致,我们可以见了不同类型的账户来保护我们的电脑,自...

乌诗狭3231linux怎么添加ntp服务器
伊琰宣18417678475 ______ 个人linux系统比如ubuntu、deepin等都已经安装了,只需要勾选同步网络时间即可.如果是服务器可以参考:[root@localhost /]# yum install ntp -y2.修改NTP配置文件,添加NTP服务器的网络位置 /etc/ntp.conf# For more information about this file, ...

乌诗狭3231怎么在centos里创建新用户 -
伊琰宣18417678475 ______ 进入mysql使用一下语句:grant select,insert,update,delete,file on *.* to text@"%" identified by "123456"; 意思是创建 text这个账户密码为123456 拥有所有远程连接权限(%表示所有,也可改成相应的ip或域名),并拥有对所有库的 插入,更新,删除权限.

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