CentOS 7 常用软件安装汇总



以下是各种默认路径汇总:
Apache的主页默认路径: /var/www/html/
Apache的配置文件路径:/etc/httpd/conf/httpd.conf

MySQL配置文件:/etc/my.cnf
MySQL数据文件夹:/var/lib/mysql
MySQL程序文件夹:/usr/bin

VsFTP配置文件:/etc/vsftpd/vsftpd.conf
VsFTP程序文件夹:/etc/vsftpd
VsFTP主上传文件夹:/var/ftp/pub
ShadowsocksR配置文件:/shadowsocksr/user-config.json


各种基本指令

cd abc -> 进入子目录
cd/ -> 进入根目录
ll -> 显示当前路径文件(详细)
ls -> 同上(简略)
cp -> 拷贝
mkdir -> 创建目录
rm -> 删除文件或文件夹
mv -> 移动文件或改名
clear -> 清屏
pwd -> 显示当前路径
more -> 显示文本文档
uname -a -> 查看当前核心版本号
vim -> 文本编辑器
fdisk -> 硬盘分区
mkfs -> 格式化
chmod -> 改变文件权限
free -> 查看剩余内存
grep -> 按条件高亮显示文本
man -> 显示命令的help文档
df -h -> 查看磁盘剩余空间
du -sh dir -> 查看文件夹名"dir"占用的空间
lsof -i:8080 -> 查看8080端口是否被占用
find . -name "filename.txt" -> 搜索当前目录下filename.txt文件,包括各级子目录

几个有用的命令:

chmod -R 777 dir (将dir整体变为777)
rm -rf dir (整体删除dir)
cp -r -a ./* /dir (将当前路径下所有文件包括子目录全部拷贝到dir)
tar -xvzf filename (解压缩gz文件)
gzip -d filename (解压缩gz文件)
unzip -x filename (解压缩zip文件)
rpm -ivh (安装一个包)
rpm -Uvh (升级一个包)
rpm -e (卸载一个包)

分区 & 格式化
1. 先看看有几个物理硬盘:
#fdisk -l 
2. 选择一个物理硬盘来分区
#fdisk /dev/vdb1 (我这儿交vdb1)
3. 进去后和DOS差不多,使用的是快捷命令:
p : 查看当前分区
d:删除当前分区
n:创建一个新的分区
w: 存盘退出(所有改动生效)
q: 不存盘、退出(所有改动不生效,安全)
这个跟老DOS很相像,一个一个子分区先删除干净之后才能建立新分区
格式化:
mkfs.ext4 /dev/vdb1
等待命令执行完成
4. 挂载新硬盘到操作系统的某个节点上
mkdir /mnt/sdd
mount /mnt/sdd /dev/vdb1

5. 大功告成后,可用 df 指令再查看查看


Installation Aapache:
1. yum install httpd.x86_64 (installation)
2. systemctl Start httpd.service (start)
3. systemctl enable httpd.service (from the start)

and then to the other side to test the browser: http: // server ip
will a very nice testing 1.2.3 test page appears.
Apache homepage default path: / var / WWW / HTML /
Apache main configuration file path: /etc/httpd/conf/httpd.conf
install the PHP:
1. yum groupinstall 'the PHP Support' -Y (installed)
2. the restart systemctl httpd.service (restart the Apache to)
install mysql support (in fact, MariaDB):
1. No need to install .CentOS which built MariaDB is fully compatible with MySQL.
(On the 5th floor of this post, I will when it comes to a complete install the official version of the MySQL posts)
2. Start
systemctl Start mariadb.service
systemctl enable mariadb.service (from the start)
MySQL initial password problem
situations (root screwed up permission denied accidentally, do not see this situation mysql table):
1. systemctl stop mariadb.service (先关服务)
2. /usr/bin/mysqld_safe --skip-grant-tables & (进入安全模式)
3. mysql -uroot (不需要密码,直接进人)
4. show databases;可以看到mysql表了
5. use mysql;
6. update user set password=password('yournewpasswordhere') where user='root';
7. flush privileges;
打通php 和 mysql:
1. yum install php-mysql (先装php-mysql) 
2. systemctl restart httpd.service (重启apache)


VSFTP 安装:
首先看看服务器装了vsftp没: rpm  -qa|grep vsftpd
我的建议是管它装没装,先卸载了再说:yum remove vsftpd
然后:
#yum install vsftpd (先装)
改: etc/vsftpd/vsftpd.conf
这两行:
anon_upload_enable=YES (允许匿名用户上传)
anon_mkdir_write_enable=YES (允许匿名用户建目录)
然后这样还是不行的,还需要把vsftp的主上传目录改为777,
否则会报553 Could not create file错误。
chmod -R 777 /var/ftp
然后回到命令行这边:
systemctl start vsftpd.service (开始服务)
systemctl enable vsftpd.service (自启)
【特别注意事项】
然后腾讯云安全组那边,要建立一个相应入站放行规则,出站无需设置,否则无法连接。
这个只针对与腾讯VPS而言,其他主机应该有相对应的防火墙策略,一般来说大同小异。
本地用户登陆,首先配置文件如下:
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=002
userlist_enable=YES
userlist_deny=YES
userlist_file=/etc/vsftpd/user_list
use_localtime=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
tcp_wrappers=YES

然后添加一个新的客户: cent
useradd cent -s /sbin/nologin 
passwd cent
mkdir /var/ftp/pub
chown -R cent /var/ftp/pub
chmod -R 755 /var/ftp/pub
配置文件里没有设置chroot_local_user (即将用户约束在各自的home文件夹)

ps: 这样设置的权限很大,用户可以浏览并修改整个服务器文件。

BTW:另外还有一款名为Bitvise SSH Client的远程访问软件,本身的作用和putty之类差不多,但它功能极其强大,自带SFTP,如果你本无意架设一个真正的FTP站点,而仅仅是为了方便自己上传下载文件的话,选择这款免费软件就足够了,无需任何设置,登录即用!


全新安装官方版MySQL:
自从MySQL被Oracle吃掉后,它与开源界关系就不太好了,
于是新发布的CentOS都没有内置MySQL,而是用MariaDB取而代之,
后者据说是MySQL原班人马维护的,号称兼容性啥的都跟以前一样,话虽这么说,可区别还是有的(下文会谈到),
以下为全新安装Oracle官方原版MySQL的方法:
1:为yum指令添加源
先搞清楚到底要下载哪个源,用指令:uname -a
看看服务器版本号,我这边显示的是el7
然后去这个网址:
http://dev.mysql.com/downloads/repo/yum/
下载一个:mysql57-community-release-el7-11.noarch.rpm  (对应之前的el7)
注意:如果是Centos 6,需要下载针对el6内核使用的rpm
然后用鼠标右键点击下载链接,复制绝对地址,直接用wget指令下载
(如果实在找不到绝对地址,也可以先用浏览器下载到本地再FTP到服务器也一样):

  1. wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

Then execute the following command:
RPM -Uvh mysql57-Community Community-Release-el7-11.noarch.rpm
this action soon, on a few seconds of thing.

2. Install the MySQL
Once you have the source, you can use this command is installed:
yum install MySQL-Server-Community Community
Note that this process is very long, be patient.

After Bahrain will be a summary, or if the original machine is equipped with Mariadb legacy MySQL, you can see
Replaced:
  MySQL-libs.i686 0: 5.1.73-8.el6_8
will be the newly installed MySQL replace (Replaced) away.

ps:
If CentOS 6, starting with the following instruction:
/etc/init.d/mysqld Start
from the start:
#vim /etc/rc.local
/etc/init.d/mysqld Start (the start command line above added to the list to) save and exit.

3. Start Services
Bahrain, open the MySQL service with the following command:
systemctl Start mysqld.service
systemctl enable mysqld.service (from the start)
systemctl Status mysqld.service (View Status)
This step is likely to go wrong, if before the old Maroadb or MySQL in / var / lib / mysql directory below (this is the main mysql data directory, all of the databases, tables and the like are stored here), it will error :
the initialize But at the specified in the data Files IT directory has the Aborting..
Fortunately, this problem is easy to solve, delete the data directory:
#rm -rf / var / lib / MySQL 

after deleting, you can not go to manually create, as long as the implementation of mysql, the program will automatically create.

4. Initialize disposed
above the mounting process, resulting in a temporary password, the /var/log/mysqld.log file,
the first step is to make it out highlighted:
grep 'Temporary password' / var / log / mysqld .log
Write down this password.

: With just the temporary password
mysql -uroot -p

change the initial password go after with this command:
the ALTER the USER 'root' @ 'localhost' IDENTIFIED BY 'NewPassword';

如果显示: Your password does not satisfy the current policy requirements

这不是大问题,只是说明密码强度不够,再想一个复杂一点的密码即可。

5. 设置远程访问
现在整个儿MySQL基本就已经装好了,但是仅限于本地使用(对于BS结构的程序来说够了)
如果还需要用Navicat等工具远程登陆,或者一些CS结构的软件,还需要做下一步:
mysql -uroot -p (首先进入mysql服务器,用刚才设置的新密码)
mysql>use mysql; 
mysql>update user set host = '%' where user = 'root'; (将root帐号的host改为%也就是说任意客户端皆可访问)
mysql>FLUSH PRIVILEGES; (全局刷新一下就OK了,现在再试试Navicat应该就能连通了)

6. 其他注意事项
尽管说MariaDB号称和MySQL是兼容的,可有一些场合还是不太对劲。
在MySQL下,可以通过直接拷贝Data文件夹的方式进行备份,
即在A电脑上把Data文件夹复制下来,然后覆盖拷贝到同样装了MySQL的B电脑上,
执行一次mysql_upgrade -u root -p,最后重启MySQL即可。
但是,如果B电脑是装的MaraiaDB,像这样直接把Data文件夹复制过去的方法则不行,无法启动。

7. 在已经设置了root密码的情况下重新修改root密码的方法(或者理解为忘记了root密码怎么办):
首先要进入安全模式
systemctl stop mysqld.service (先关mysql服务)
vi /etc/my.cnf (修改mysql配置文件)
加入一行:
skip-grant-tables
依次按下ESC : w q ! (依次按下这5个建,记住不是同时按下哦,再按回车,表示存盘退出)
systemctl start mysqld.service (启动mysql)
mysql -uroot -p (不需要密码直接进入)
use mysql;
update mysql.user set authentication_string = PASSWORD('123456') where User='root'; 
FLUSH PRIVILEGES;
quit;
从mysql命令行模式出来之后,
systemctl stop mysqld.service (先关闭mysql)
vi /etc/my.cnf
去掉skip-grant-tables这一行,或者在前面加个#号注释掉 (不能一直让mysql工作在安全模式里面啊,root都不需要密码的,尺度太大了)
改完之后,像前面一样,依次按下 ESC : w q ! 这5个键,存盘退出。
systemctl start mysqld.service (再重启mysql即可)


科学安装

千言万语抵不过2个链接,都懂:

https://github.com/leitbogioro/SSR.Go

Windows客户端:https://kiwivm.64clouds.com/dist/ShadowsocksR-4.6.1-win.7z


Seafile私有云的安装

下载:
http://www.seafile.com/download
手工建立主目录:
mkdir haiwen 【假设公司名为haiwen】
mv seafile-server_* haiwen
cd haiwen
解压:
tar -xzf seafile-server_*
mkdir installed

下面开始安装python
mv seafile-server_* installed
yum -y install epel-release
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
【yum -y install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel python-pip】注意,中括号里的内容是一个整行,切忌分开。

pip install --upgrade pip
pip install pillow 
pip install moviepy
[pip是python下的安装器,类似centos下的yum,腾讯VPS的外部防火墙(他们称其为安全组)干扰了pip的下载端口,需要暂时关闭]
cd seafile-server-*
./setup-seafile-mysql.sh  #运行安装脚本并回答预设问题
上面这步会自动检查运行环境,需要全部调通才能继续。
如果画面显示这个:
------------------------------------------------------
Please choose a way to initialize seafile databases:
-------------------------------------------------------
[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases
那么恭喜你,环境就调通了,以下是一些初始化设置。
按1表示创建一个新的mySQL数据库以供它使用,
按2表示这个数据库已经存在,在此我们按1,
然后就是询问你mysql的root密码,服务器ip地址之类的常规问题,
这里不再赘述。

全部安装完毕后,
启动 Seafile:
./seafile.sh start
启动 Seahub
./seahub.sh start  (默认运行在8000端口上)
第一次启动 seahub 时,seahub.sh 脚本会提示你创建一个 seafile 管理员帐号。
服务启动后, 打开浏览器并输入以下地址
http://IP地址:8000/
就可以用刚才创建那个管理员帐号登陆了。
重启:
./seafile.sh restart # 停止当前的 Seafile 进程,然后重启 Seafile
./seahub.sh restart  # 停止当前的 Seahub 进程,并在 8000 端口重新启动 Seahub
让seafile自动启动:
在编辑以下文件之前,先执行:
which python2.7
看看python到底装在那个路径下,
然后编辑系统文件(这玩意有点像dos下的autoexec.bat)
vim /etc/rc.local
加上以下内容:
PATH=$PATH:/usr/bin/  (这个地方填你刚才用which python2.7显示的路径)
sudo -u root /haiwen/seafile-server-latest/seafile.sh start
sudo -u root /haiwen/seafile-server-latest/seahub.sh start    (haiwen就是刚才建的主目录)
这三行内容添加好了之后,老规矩:esc : w q ! 存盘退出。

重启服务器试试。


安装NodeJS
Nodejs安装相对简单,只需要两条指令:
1. curl --silent --location https://rpm.nodesource.com/setup_9.x | sudo bash -
2. yum -y install nodejs
安装完之后,输入node进入node命令行界面,或者输入npm,如果有提示,表示安装完毕!

方法2:

wget https://npm.taobao.org/mirrors/node/v11.0.0/node-v11.0.0.tar.gz
tar -xvf node-v11.0.0.tar.gz
cd node-v11.0.0
yum install gcc gcc-c++
./configure
make (此过程大概半小时)
sudo make install
node -v
执行并修改 vi /etc/profile,在文件末尾加上如下两行(DEMO)代码

PATH=$PATH:/usr/local/bin/node
export PATH
存盘退出。
执行:
source /etc/profile 或 ./profile
echo $PATH


WEB服务器测试:
1. mkdir helloworld
2. cd helloworld
3. npm init(连按几次回车进行初始化)
4. npm install express --save (安装express框架)
5. vim index.js (编辑index.js文件)

6. 复制以下代码:

[javascript] view plain copy

  1. var express = require('express');  
  2. var app = express();  
  3.   
  4. app.get('/'function (req, res) {  
  5.   res.send('Hello World!');  
  6. });  
  7.   
  8. var server = app.listen(3000, function () {  
  9.   var host = server.address().address;  
  10.   var port = server.address().port;  
  11.   
  12.   console.log('Example app listening at http://%s:%s', host, port);  
  13. });  

7. Save and exit
8. The input node index.js (running just edited the code, in fact, a miniature WEB server)

Note: with other WEB server (such as Apache) different, nodejs is a single-process server,
it does not will serve as a resident background, on the contrary it must remain a running state in the foreground,
therefore, at this time the command line will hang and display Example App Listening aT HTTP: // ::: 3000,


9. in the browser window enter the HTTP: // localhost: 3000
10. If all goes well, the browser will display "the Hello World!"

11. back to the command-line side, press CTRL + C to exit the program, then WEB service will be terminated.
      To turn WEB service again, need to re-run the code, the input: node index.js to

install forever deployment tools, with this you can run in the background nodejs:

npm install forever -g


Java JDK installation environment

1. Access:  http://www.oracle.com/technetwor ... nloads-2133151.html (download the corresponding rpm package, CentOS 7 download jdk-8u151-linux-x64.rpm, ps: only use the browser then download the uploaded to the server, not directly wget) 2. mkdir / usr / java (Java installed in / usr / java Lane) 3. CD / usr / java 4. rpm package uploaded to the / usr / java 5. the rpm - the JDK-8u151 Linux-IVH-x64.rpm 6. enter java -version, if not an error, but the pop java version, the installation is successful! 






GNOME environment installed + VNC server installed

Step 1 - Create two VNC account and password

useradd -c "User Joe Configured for VNC Access" joevnc
passwd joevnc
useradd -c "User Jane Configured for VNC Access" janevnc
passwd janevnc

PS: this example is configured with two VNC user joevnc and janevnc, if only one user, you can create an account.

Step 2 - install the GNOME desktop

yum groupinstall -y "GNOME Desktop"
reboot

Step 3 - Installation TigerVNC Server

yum install -y tigervnc-server

Step 4 - Set VNC Service two clients
is joevnc and janevnc just set the vncserver default settings files are copied to two separate settings file, numbered 4 and 5:

cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:4.service
cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:5.service

4 with a modified profile vi editor, the user is joevnc settings file:

vi /etc/systemd/system/vncserver@:4.service

找到两处<USER>,将他们改为joevnc:
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l
joevnc -c "/usr/bin/vncserver %i" 
PIDFile=/home/
joevnc/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

Yihuhuhuapiao, the janevnc configuration files are changed again, not repeat them here.
Then restart the daemon:

systemctl daemon-reload

Open No. 4 VNC (that is, the user joevnc profile) Services:

systemctl start vncserver@:4.service

Let No. 4 VNC service boot from the start: 

systemctl enable vncserver@:4.service

Then No. 5 VNC service (janevnc) also operate again, not discussed here.

Step 5 - Set up a firewall
Turn on the firewall:

systemctl start firewalld

Open 5904 and 5905 these two ports:

firewall-cmd --permanent --zone=public --add-port=5904-5905/tcp

(你可能会问,为啥是这两个端口?因为TigerVNC自身使用5900端口,而每一个VNC用户又都拥有自己的独立端口号,规定以 “5900+VNC用户编号” 为原则,刚才配置文件编号是4和5,那么这两个独立进程的端口就是5900+4和5900+5,当然编号随你自己设置,不一定非要4和5,反正记住规则是 “5900+编号” 就行了)

刷新防火墙设置

firewall-cmd --reload

如果总是报错,可以用systemctl stop firewalld 和 systemctl disable firewalld 干脆把防火墙先关再说。

Step 6 — 设置 VNC 密码
注销当前用户:

exit


然后重新打开一个命令行终端连接,以joevnc身份登录,
输入:

vncserver

设置一个访问密码,记住这是vnc的访问密码,跟joevnc本身的系统密码不是一回事。
注销joevnc,以janevnc登陆,按照上面的方法依葫芦画瓢一次。

Step 7 — 使用VNC客户端软件
下载地址:http://www.onlinedown.net/soft/251613.htm
安装很简单,一直下一步即可,打开主界面也没什么可设置的,直接在地址框输入:

你的服务器IP:5904,如127.0.0.1:5904 

输入完毕后点 Connect 即可。

端口5904对应的是joevnc
端口5905对应janevnc

另外,如果你登陆桌面的时候,即使输入了正确的密码还是报错:sorry.that didn't work.please try again 
那就先回到命令行,输入:

passwd 用户名

重新输入一次密码,更新之后桌面那边就可以使用了。

参考文章:

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-remote-access-for-the-gnome-desktop-on-centos-7

--------------------------------------
CentOS7下装Chrome:
先下载Chrome:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

然后用rpm安装:

rpm -ivh google-chrome-stable_current_x86_64.rpm


基本上会报一堆错误,例如:

warning: google-chrome-stable_current_x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
error: Failed dependencies:
    /usr/bin/lsb_release is needed by google-chrome-stable-74.0.3729.131-1.x86_64
    libXss.so.1()(64bit) is needed by google-chrome-stable-74.0.3729.131-1.x86_64
    libappindicator3.so.1()(64bit) is needed by google-chrome-stable-74.0.3729.131-1.x86_64
    liberation-fonts is needed by google-chrome-stable-74.0.3729.131-1.x86_64

不要着急,报错是正常的流程之一,现在用repoquery命令一个一个分析,比如:

repoquery --nvr --whatprovides  libappindicator3.so.1

系统显示:

libappindicator-gtk3-12.10.0-13.el7

发现少了这个包,那么我们直接用yum去安装:

yum install libappindicator-gtk3-12.10.0-13.el7 -y

其他依葫芦画瓢都这么一个一个用yum安装即可,唯一需要注意的是,/usr/bin/lsb_release 这个包是这样安装的:

yum install *lsb* -y

对于我的系统而言,我需要安装以下包:

yum install libXScrnSaver-1.2.2-6.1.el7 -y
yum install libappindicator-gtk3-12.10.0-13.el7 -y
yum install liberation-fonts-1.07.2-16.el7 -y
yum install *lsb* -y

装完之后,再输入一遍:

rpm -ivh google-chrome-stable_current_x86_64.rpm

这回终于不报错了,安装成功。

回到桌面,发现桌面的Internet分类里已经有了Chrome的图标了。
如果无法启动,说明你现在使用的是root账户,因为chrome默认是不能给root用户运行的。
打开文件管理器,找到 /usr/share/applications/路径下的Chrome图标,右键属性,然后把Command改成:

/usr/bin/google-chrome-stable %U --no-sandbox 

或者直接在桌面的Terminal里面用命令行启动:

/usr/bin/google-chrome-stable --no-sandbox

CentOS 7 开机自动启动脚本的方法
1. 在 /usr/lib/systemd/system 下面创建一个文件,这个文件名即是我们要设置的服务,例如现在想自定义一个服务rockage:

vim /usr/lib/systemd/system/rockage.service

2. 在此文件中输入服务设置代码:

[UNIT]
Description=Node.JS WebSite
After=network.target

[Service]
Type=forking
WorkingDirectory=/root/myweb
User=root
ExecStart=/root/myweb/start.sh
ExecReload=/root/myweb/restart.sh
ExecStop=/root/myweb/stop.sh
PrivateTmp=true

[Install]
WantedBy=multi-user.target

3. 有四个项目需要按你的实际情况填写:
Description:服务描述(随便填)
WorkingDirectory: 工作目录
ExecStart:用于启动服务的脚本
ExecReload:用于重新运行服务的脚本
ExecStop:用于停止的脚本
以上参数,除了Description可以瞎填之外,其他几个一定要填脚本的绝对地址。

此外,重启(ExecReload)和停止(ExecStop)这两个脚本并不是必须的,如果你仅仅是想开机运行一个东西的话,只设置一个启动脚本(ExecStart)足矣。

4. 存盘退出,将这个文件的权限修改为754:

chmod 754 rockage.service

5. 输入以下命令测试脚本是否正确,例如本例中的rockage服务:

systemctl daemon-reload (重载系统服务)
systemctl start rockage (启动我们刚才设置的rockage服务)

6. 如报错,可能的原因有:

  1. 脚本的路径不正确,没有使用绝对路径
  2. User 选项必须填一个用户名
  3.  脚本本身有问题,作为服务脚本而言,第一行必须是#!开头的,这不是注释,而是标明这个脚本是由哪个shell来执行,不可或缺,否则会报错。例如我们经常见到的:#!/bin/bash
  4. 脚本的权限也得是754,否则会报错,务必用chmod 754 脚本文件名,将它们设置好。

  7. 下面给出我设置的3个脚本以供参考(此脚本自动运行node.js的forever,作用是将nodejs制成的网站置于后台运行

- /root/myweb/start.sh :

#!/bin/bash
forever start ./bin/www

- /root/myweb/stop.sh :

#!/bin/bash
forever stopall

- /root/myweb/restart.sh :

#!/bin/bash
forever stopall
forever start ./bin/www

8. 通过以下三个命令反复测试脚本:

systemctl start rockage (启动)
systemctl stop rockage (停止)
systemctl restart rockage (重启)

9. 正确无误,不报错,启停正常后,可以将这个服务写入开机启动项:

systemctl enable rockage

10. 或者取消开机启动:

systemctl disable rockage

11. 查看服务状态:

systemctl status rockage

12. 查看所有已启动的服务

systemctl list-units --type=service

NextCloud 私有云

1. 安装docker
yum install -y docker
或者:
curl -sSL https://get.docker.com/ | sh

2. 启动docker服务
systemctl start docker
systemctl enable docker.service

3.安装Nextcloud
docker run -d --name nextcloud -p 80:80 -v /root/nextcloud:/data rootlogin/nextcloud

其中,80:80的意思是本机端口映射到docker端口的80,前面那个可以随便改,比如8080:80, 9090:80等等,后面那个80不能随意改,比如这里定为8080端口,那么实际访问的时候就是在浏览器里输入:http://your.ip:8080,首次访问会让你设置管理员帐号,MySQL数据库等资料,注意:可以用NaviCat等工具,手动在你的MySQL里创建一个数据库,并添加一个与你的nextcloud管理员相同的用户名,主机填%即可。设置成功后,你的网盘地址里面直接就有跳转到PC客户端和手机客户端的下载链接,这里不再赘述。

如报错:

99%都是由于MySQL没设置好的原因,标准流程:

以下操作如果你不是很熟悉MySQL命令行的话,建议采用NaviCat等图形化工具来做:

1. 在你的MySQL里创建一个数据库,比如nextcloud
2. 新添加一个MySQL用户,比如nextadmin
3. 设置nextadmin用户有对nextcloud数据库进行操作的所有权限
4. nextadmin用户的“主机”,设为 %
5. 返回浏览器这边,输入http://你的ip.com:端口
6. 首次访问会让你设置一个管理员, 填nextadmin,访问密码随意填
7. 界面的下方是MySQL设置,用户名也填nextadmin,注意此处的密码是你的MySQL密码,而不是访问密码
8. 数据库填nextcloud
9. 数据库地址填:localhost:3306或者: 你的ip:3306
10. 点完成,时间会比较长,要耐心等待。

最后,Nextcloud的默认文件夹在:root/data/用户名/files/ 里面,你同步的所有内容都能在里面找到。

Guess you like

Origin blog.csdn.net/rockage/article/details/79441336