ubuntu16.04 nginx+lua+mysql+navicat+redis+openresty+Xshell+git环境搭建,nginxnavicat



>>>>>>>>>>>>>>>>>>>>git<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>git<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>git<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>git<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>git<<<<<<<<<<<<<<<<<<<<
Git是一款免费、开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。通过使用git工具,我们可以实现团队间合作开发统一管理,可以从远程仓库中提取代码,也可以把代码上传到远程仓库,从而实现代码的同步更新。

这几天在ubuntu16.04安装了git,下面记录一下安装的流程。

1.首先打开控制台,在控制台输入git命令,提示我们安装git
/home/bhj/图片/Wallpapers/git_安装.png
2.在控制台输入sudo apt-get install git,接着输入超级用户密码,在接下来的提示中输入Y
/home/bhj/图片/Wallpapers/git_安装_1.png
3.这时候控制台提示安装信息
/home/bhj/图片/Wallpapers/git_安装_2.png
4.等待git安装完毕
/home/bhj/图片/Wallpapers/git_安装-3.png
5.输入git测试是否安装成功
/home/bhj/图片/Wallpapers/git_安装_4.png
6.配置git用户名和邮箱,之后就可以使用git工具了
/home/bhj/图片/Wallpapers/git_安装_5.png

 

 

>>>>>>>>>>>>>>>>>>>>XShell<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>XShell<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>XShell<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>XShell<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>XShell<<<<<<<<<<<<<<<<<<<<
1、下载安装xshell客户端,在安装时可以选择个人/学校免费版,这样不需要付费。

2、安装完成之后,如果你直接连接Ubuntu主机会发现连接不上,这是因为Ubuntu主机没有开启SSH服务,需要开启openssh-server:

root@ubuntu:~# sudo apt-get install openssh-server

使用

root@ubuntu:~# ps -e | grep ssh

如果只有ssh-agent表示还没启动,需要

root@ubuntu:~# /etc/init.d/ssh start

如果显示sshd则说明已启动成功。

3、打开Xshell,选择“新建”,“连接”设置里选择SSH,主机填入需要连接的主机的IP地址。在“用户身份验证”中填入可用的登录Ubuntu的用户名和密码。

注:如果你确认输入的用户名和密码都没有问题,但登录还是显示如下情况,拒绝你的输入的密码的话:
/home/bhj/图片/Wallpapers/XShell_安装.png

需要编辑一下/etc/ssh/sshd_config文件:

root@ubuntu:~# /etc/ssh/sshd_config

将 PermitRootLogin改为yes:
/home/bhj/图片/Wallpapers/XShell_安装_1.png

改为:
/home/bhj/图片/Wallpapers/XShell_安装_2.png

之后重启ssh-server即可:

root@ubuntu:~# sudo /etc/init.d/ssh restart

如果还不行,重启一下虚拟机,之后应该就能连接上了。

XShell连接CentOS 7.2显示中文乱码问题的解决方法  http://www.linuxboy.net/Linux/2017-03/141385.htm

Xshell自动保存用户名后的更改方法 http://www.linuxboy.net/Linux/2017-04/143030.htm

Xshell 5如何连接本地虚拟机  http://www.linuxboy.net/Linux/2016-08/134087.htm

XShell本地上传文件到Ubuntu上及从Ubuntu下载文件到本地  http://www.linuxboy.net/Linux/2017-06/145191.htm

VMware下Ubuntu虚拟机NAT模式连接Xshell  http://www.linuxboy.net/Linux/2016-09/135366.htm

Xshell5连接VirtualBox虚拟机中的Ubuntu  http://www.linuxboy.net/Linux/2016-08/134086.htm

Xshell连接本地 VirtualBox Ubuntu  http://www.linuxboy.net/Linux/2017-04/142445.htm

使用XShell密钥认证登录Linux服务器  http://www.linuxboy.net/Linux/2017-06/144405.htm

本文永久更新链接地址:http://www.linuxboy.net/Linux/2017-08/146222.htm

 

 

>>>>>>>>>>>>>>>>>>>>navticat<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>navticat<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>navticat<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>navticat<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>navticat<<<<<<<<<<<<<<<<<<<<
1.打开navicat官网,下载所需的navicat,网址:http://www.navicat.com/en/download/download.html
2.进入下载目录,解压压缩包,解压命令如下:tar -zxvf navicat110_mysql_en.tar.gz
3.打开解压后的目录,会看到 start_navicat文件  运行他就可以了
命令如下:./start_navicat
按以上方法执行./start_navicat,启动不了,没有任何反应,也没有错误提示,原因是两个:

1.没有装wine,执行sudo apt-get install wine
/home/bhj/图片/Wallpapers/navicat_apt.png

安装过程中出现如下窗口,按下tab键点击确定
/home/bhj/图片/Wallpapers/navicat_apt_1.png

点击是按钮
/home/bhj/图片/Wallpapers/navicat_apt_2.png    

2.能文本方式打开start_navicat,查找winboot,改成wineboot,然后保存。
再启动./start_navicat就OK了。
/home/bhj/图片/Wallpapers/navicat_apt_3.png

 

 

>>>>>>>>>>>>>>>>>>>>openresty<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>openresty<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>openresty<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>openresty<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>openresty<<<<<<<<<<<<<<<<<<<
第1步 - 下载OpenResty的源代码和依赖关系
在本节中,我们将从源代码安装OpenResty。 首先,从OpenResty网站的下载页面找到最新的OpenResty源代码版本。下载tarball,确保如果更改了版本号,请使用最新版本号。

wget https://openresty.org/download/openresty-1.11.2.2.tar.gz

下载PGP密钥文件,以便我们可以验证文件的内容。

wget https://openresty.org/download/openresty-1.11.2.2.tar.gz.asc

接下来,我们需要添加作者的公共密钥,如下载页面上所列。在撰写本文时,这是公钥A0E98066 。但是,请检查它是否已更改;它被列在同一下载页面上。

gpg --keyserver pgpkeys.mit.edu --recv-key A0E98066

您应该看到以下输出(用您的用户名代替sammy ):

gpg: directory `/home/sammy/.gnupg' created
gpg: new configuration file `/home/sammy/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/sammy/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/sammy/.gnupg/secring.gpg' created
gpg: keyring `/home/sammy/.gnupg/pubring.gpg' created
gpg: requesting key A0E98066 from hkp server pgpkeys.mit.edu
gpg: /home/sammy/.gnupg/trustdb.gpg: trustdb created
gpg: key A0E98066: public key "Yichun Zhang (agentzh) <agentzh@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

检查公钥(在这种情况下,它是“Yichun Zhang”)上的名称与OpenResty网站上列出的名称匹配。 现在,检查签名文件是否与下载的.tar.gz文件匹配。

gpg openresty-1.11.2.2.tar.gz.asc

您将看到以下输出:

gpg: assuming signed data in `openresty-1.11.2.2.tar.gz'
gpg: Signature made Thu 17 Nov 2016 10:24:29 PM UTC using RSA key ID A0E98066
gpg: Good signature from "Yichun Zhang (agentzh) <agentzh@gmail.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 2545 1EB0 8846 0026 195B  D62C B550 E09E A0E9 8066

您看到的警告是因为您尚未亲自验证此密钥是否属于所有者(即,您尚未使用自己的私钥签署公钥)。没有一个简单的方法来完全保证这个公钥属于所有者,它不是完全信任的。 但是,在这种情况下, 良好的签名表示此文件确实是OpenResty的作者计划分发的文件,因此我们可以继续安装。 接下来,提取下载的文件,并移动到新创建的目录。

tar -xvf openresty-1.11.2.2.tar.gz
cd openresty-1.11.2.2

我们将需要安装必要的工具来编译OpenResty。有关从源代码编译程序的更多信息,请参阅本教程,了解如何使用make从源代码安装软件包 。

sudo apt-get install build-essential

我们还需要安装一些其他包:

    readline :这将被OpenResty用于命令行界面。
    ncurses :这是另一个软件,OpenResty将使用它的命令行界面。
    PCRE :此软件将为OpenResty提供正则表达式功能。
    OpenSSL :OpenSSL用于安全通信,例如TLS(HTTPS)。
    Perl :Perl是一种可以在OpenResty中使用的编程语言。

要安装这些软件包,请执行以下命令:

sudo apt-get install libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl

我们现在拥有构建和安装OpenResty所需的所有组件。
第2步 - 安装OpenResty
我们将配置OpenResty与PCRE正则表达式和IPv6支持。我们还将通过提供-j2标志来并行化构建过程的一部分,这将告诉make 2个作业可以同时运行。此命令将主要测试所有依赖项是否可用于您的系统,并收集将由构建步骤稍后使用的信息。它也已经构建了一些依赖项,如LuaJIT。

./configure -j2 --with-pcre-jit --with-ipv6

然后,您可以通过提供-j2并行度标志来构建OpenResty。这将编译OpenResty本身。

make -j2

最后,您可以安装OpenResty。使用sudo确保所有文件可以复制到系统上的正确位置,以便OpenResty可以在运行时找到它们。

sudo make install

您需要在防火墙中允许HTTP连接才能使Web服务器正常工作。

sudo ufw allow http

您也可以选择允许HTTPS与sudo ufw allow https如果你要使用它。您可以通过检查防火墙的状态来验证防火墙的更改。

sudo ufw status

您应该看到显示的输出中允许HTTP流量(端口80 ),以及如果您添加它的HTTPS(端口443 )。

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
80                         ALLOW       Anywhere
443                        ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
80 (v6)                    ALLOW       Anywhere (v6)
443 (v6)                   ALLOW       Anywhere (v6)

您现在可以检查安装是否有效。首先,启动OpenResty。

sudo /usr/local/openresty/bin/openresty

如果命令成功,它将立即完成而不输出文本。在这种情况下,您可以在浏览器中访问http:// your_server_ip 。 你会看到一个页面,说欢迎来到OpenResty!确认它已完全安装和工作。 您现在可以停止OpenResty服务器。

sudo /usr/local/openresty/bin/openresty -s quit

OpenResty已安装,但您仍需要配置OpenResty在启动时运行,所以服务器不必手动启动。
第3步 - 将OpenResty设置为服务
在这里,我们将OpenResty设置为一个服务,所以它在启动时自动启动。我们将使用systemd init服务。 您可以阅读此systemd基础教程了解更多信息,以及本单元文件教程 ,了解单元文件的具体信息。 首先使用nano或您喜欢的文本编辑器创建一个新的systemd文件。

sudo nano /etc/systemd/system/openresty.service

对于本教程,我们将从全新安装中复制默认的Nginx systemd文件,并针对OpenResty进行修改。完整的文件看起来像这样,应粘贴到我们刚打开的文件。我们将遍历文件的每个部分来解释它在做什么。
/etc/systemd/system/openresty.service

# Stop dance for OpenResty
# A modification of the Nginx systemd script
# =======================
#
# ExecStop sends SIGSTOP (graceful stop) to the Nginx process.
# If, after 5s (--retry QUIT/5) OpenResty is still running, systemd takes control
# and sends SIGTERM (fast shutdown) to the main process.
# After another 5s (TimeoutStopSec=5), and if OpenResty is alive, systemd sends
# SIGKILL to all the remaining processes in the process group (KillMode=mixed).
#
# Nginx signals reference doc:
# http://nginx.org/en/docs/control.html
#
[Unit]
Description=A dynamic web platform based on Nginx and LuaJIT.
After=network.target

[Service]
Type=forking
PIDFile=/run/openresty.pid
ExecStartPre=/usr/local/openresty/bin/openresty -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/local/openresty/bin/openresty -g 'daemon on; master_process on;'
ExecReload=/usr/local/openresty/bin/openresty -g 'daemon on; master_process on;' -s reload
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/openresty.pid
TimeoutStopSec=5
KillMode=mixed

[Install]
WantedBy=multi-user.target

在[Unit]部分:

    After=network.target使OpenResty在网络启动后启动,以便OpenResty可以绑定和监听端口。这允许从外部到达它。

在[Service]部分:

    Type=forking告诉systemd我们在ExecStart中调用的ExecStart将在ExecStart启动服务,并且进程将在后台停止自身。
    PIDFile=/run/openresty.pid告诉systemd在哪里可以找到OpenResty在启动时创建的PID文件。 这使得systemd知道OpenResty是否仍在运行。
    ExecStartPre=/usr/local/openresty/bin/openresty -t -q -g 'daemon on; master_process on;' 调用OpenResty脚本而不启动它。 -t标志告诉OpenResty我们只想测试配置文件; -q标志告诉它我们想要抑制任何非错误输出; -g标志设置全局指令daemon on; master_process on daemon on; master_process on告诉OpenResty我们希望它在后台作为守护进程启动。 我们执行这个脚本作为ExecStartPre ,这样当配置文件无效时, systemd将不会尝试启动OpenResty,因为它将错误在这个命令。
    ExecStart=/usr/local/openresty/bin/openresty -g 'daemon on; master_process on;' 实际上启动OpenReesty。 这与没有-t标志的ExecStartPre相同。
    ExecReload=/usr/local/openresty/bin/openresty -g 'daemon on; master_process on;' -s reload ExecReload=/usr/local/openresty/bin/openresty -g 'daemon on; master_process on;' -s reload告诉systemd在运行systemctl reload openresty时运行此命令。 -s标志告诉OpenResty重新加载其配置文件。
    ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/openresty.pid告诉systemd在OpenResty停止时运行此命令。 它将SIGSTOP发送到PID文件中列出的进程。 如果它仍然运行5秒钟后, systemd将通过以下两个选项来控制。
    TimeoutStopSec=5告诉systemd我们希望进程在5秒内停止。 如果它不停止, systemd将强制尝试停止OpenRest。
    KillMode=mixed指定systemd如何在5秒后没有停止时尝试停止OpenResty。

在[Install]部分:

    WantedBy=multi-user.target告诉systemd当我们想要启动服务,如果它被配置为在启动时启动。 multi-user.target意味着只有在多用户系统启动时才启动服务,即我们可以将OpenResty作为不同的用户运行。

这是所有的etc/systemd/system/openresty.service文件。接下来,我们需要定制OpenResty Nginx配置文件并启用服务。 首先打开配置文件。

sudo nano /usr/local/openresty/nginx/conf/nginx.conf

默认情况下,它将如下所示:
默认/usr/local/openresty/nginx/conf/nginx.conf

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

. . .

删除事件之前的所有行events { line,并将其替换为以下三行:
更新了/usr/local/openresty/nginx/conf/nginx.conf

user www-data;
worker_processes  auto;
pid /run/openresty.pid;

events {
    worker_connections  1024;
}

. . .

这个文件将确保我们作为www-data用户运行,并且systemd可以识别OpenResty何时运行,因为OpenResty一旦启动就创建了pid行。 保存并关闭文件。 接下来,创建日志目录。

sudo mkdir /var/log/openresty

重新加载systemd服务,以便它可以找到我们的文件。

sudo systemctl daemon-reload

现在,通过systemd启动OpenResty。

sudo systemctl start openresty

您现在可以再次访问http:// your_server_ip ,并查看与之前相同的网页。 区别是现在,进程已经由systemd 。 最后一步是启用该服务,以确保OpenResty在启动时启动。

sudo systemctl enable openresty

您可以在我们的服务和单元教程中了解有关管理systemd服务和单元的更多信息。 现在我们已经配置了服务,我们可以进一步配置OpenResty,以便它将例如登录到公共位置。
第4步 - 配置OpenResty
要配置OpenResty,我们使用默认的Nginx配置作为参考,以便它大部分匹配你可能会熟悉的。 首先,再次打开OpenResty配置文件:

sudo nano /usr/local/openresty/nginx/conf/nginx.conf

这一次,我们将修改http块并将此http块中的server块移动到一个新文件以具有更好的结构。 首先,找到http {行,并删除之后的一切,除了最后一行与对应的} 。
当前/usr/local/openresty/nginx/conf/nginx.conf

user www-data;
worker_processes  auto;
pid /run/openresty.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    . . .
}

然后,将以下内容复制到http块中,以便整个文件看起来像这样。我们将一次过一个更改。
/usr/local/openresty/nginx/conf/nginx.conf

user www-data;
worker_processes  auto;
pid /run/openresty.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;

    keepalive_timeout  65;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    access_log /var/log/openresty/access.log;
    error_log /var/log/openresty/error.log;

    gzip  on;
    gzip_disable "msie6";

    include ../sites/*;
}

保存并关闭文件。 我们对默认文件所做的更改是:

    取消tcp_nopush on; ,它告诉OpenResty只发送完整的数据包。 当使用sendfile选项时,此选项很有用,这将允许OpenResty优化将静态文件发送到客户端。
    添加tcp_nodelay on; 。 此选项将尝试尽快发送数据包,这可能看起来与上述选项相反,但它在不同的时间使用。 tcp_nodelay仅在对HTTP请求使用keepalive选项时使用,这是通过Web浏览器连接到Web服务器,这将避免每次请求时启动HTTP连接的开销。
    添加和修改ssl_protocols和ssl_prefer_server_ciphers行。这些选项配置OpenResty的SSL选项。我们删除了易受已知的HTTPS攻击的旧协议,例如POODLE攻击。
    添加access_log和error_log行,它们配置Web服务器的日志位置。 我们将日志存储在上一步中创建的/var/log/openresty目录中。
    取消注释gzip on并添加gzip_disable "msie6" 。这些选项将配置GZIP,这将压缩网页,以便有更少的数据传输。我们还添加了最后一个选项,因为Internet Explorer 6(及更早版本)并不总是正确处理GZIP内容。
    添加include ../sites/*; ,它告诉OpenResty在/usr/local/openresty/nginx/sites目录中查找额外的配置文件,稍后我们将创建它。
    删除所有server块,我们将在此步骤中稍后重新定位到新文件。

接下来,创建我们在include行中指定的新sites目录。

sudo mkdir /usr/local/openresty/nginx/sites

创建default网站。

sudo nano /usr/local/openresty/nginx/sites/default.conf

在此新文件中添加以下内容。这是从nginx.conf重新定位原始服务器块,但有更多细节的内联注释。
/usr/local/openresty/nginx/sites/default.conf

server {
    # Listen on port 80.
    listen 80 default_server;
    listen [::]:80 default_server;

    # The document root.
    root /usr/local/openresty/nginx/html/default;

    # Add index.php if you are using PHP.
    index index.html index.htm;

    # The server name, which isn't relevant in this case, because we only have one.
    server_name _;

    # When we try to access this site...
    location / {
        # ... first attempt to serve request as file, then as a directory,
        # then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

    # Redirect server error pages to the static page /50x.html.
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root /usr/local/openresty/nginx/html;
    }
}

保存并关闭文件。 现在,为此网站创建一个新目录。

sudo mkdir /usr/local/openresty/nginx/html/default

然后将原始index.html从其原始位置移动到新目录。

sudo mv /usr/local/openresty/nginx/html/index.html /usr/local/openresty/nginx/html/default

最后,重新启动OpenResty以使用此新站点。

sudo systemctl restart openresty

您现在可以再次访问http:// your_server_ip ,并查看与之前相同的网页。 现在OpenResty是完全配置的,我们可以尝试一些由OpenResty介绍的,在Nginx默认情况下不可用的功能。
第5步 - 使用OpenResty Lua模块
在本节中,我们将看看OpenResty添加的不同模块的组合,这些模块都存在以适应Lua脚本。我们将在整个步骤中/usr/local/openresty/nginx/sites/default.conf /usr/local/openresty/nginx/sites/default.conf,因此首先打开它。

sudo nano /usr/local/openresty/nginx/sites/default.conf

首先,我们将看一下content_by_lua_block配置选项。 从下面的示例配置中复制location块,并将其添加到server块中,位于两个现有location块下面。
/usr/local/openresty/nginx/sites/default.conf content_by_lua_block示例

server {
    . . .

    location /example {
         default_type 'text/plain';

         content_by_lua_block {
             ngx.say('Hello, Sammy!')
         }
    }
}

保存并关闭文件,然后重新加载配置。

sudo systemctl reload openresty

如果您http:// your_server_ip /example访问http:// your_server_ip /example ,您会看到一个http:// your_server_ip /example 您好,Sammy的页面! 。让我们解释这是如何工作的。 content_by_lua_block配置指令执行其中的所有内容作为Lua代码。 在这里,我们使用Lua函数ngx.say来打印消息Hello,Sammy!到页面。 对于另一个示例,将location /example块的内容替换为:
/usr/local/openresty/nginx/sites/default.conf content_by_lua_file示例

server {
    . . .

    location /example {
         default_type 'text/plain';

         content_by_lua_file /usr/local/openresty/nginx/html/default/index.lua;
    }
}

content_by_lua_file从外部文件加载Lua内容,所以让我们创建上面指定的内容: /usr/local/openresty/nginx/html/default/index.lua 。

sudo nano /usr/local/openresty/nginx/html/default/index.lua

将以下内容添加到文件,然后保存并将其关闭。
/usr/local/openresty/nginx/html/default/index.lua

local name = ngx.var.arg_name or "Anonymous"
ngx.say("Hello, ", name, "!")

这是一个简单的Lua,它读取URL中的查询参数, name并自定义问候消息。如果没有传递参数,则使用“匿名”。 再次重新加载配置。

sudo systemctl reload openresty

现在,在浏览器中访问http:// your_server_ip /example?name= Sammy 。 这将显示你好,Sammy! 。 您可以更改name查询参数,或完全忽略它。

Hello, Sammy!

您还可以更改name查询参数以显示任何其他名称。 警告:请勿将您要加载的Lua文件从Web访问到的位置。 如果这样做,如果有人访问此文件,则可能会包含应用程序代码。 将文件放在文档根目录之外,例如,将文档根目录更改为/usr/local/openresty/nginx/html/default/public ,并将Lua文件放在其上一个目录。

 

 

 

>>>>>>>>>>>>>>>>>>>>mysql<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>mysql<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>mysql<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>mysql<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>mysql<<<<<<<<<<<<<<<<<<<<<<
一、apt-get update

首先需要把apt-get更新到最新,不然可能会发生不知名错误。。。如果不是root用户请自行加上sudo。。
二、安装 mysql-client-core-5.6

输入命令安装mysql。

apt-get install MySQL-client-core-5.6

    1

三、安装mysql-client-5.6

输入命令安装mysql客户端程序。

apt-get install mysql-client-5.6

    1

四、安装 mysql-server-5.6

apt-get install mysql-server-5.6

    1

注意:在安装的时候会让你输入一个密码,此密码是mysql数据库root用户的密码,请记住自己输入的密码,此密码和服务器root用户的密码不是同一个。
五、检查mysql是否启动

输入命名重启mysql看是否安装成功

service mysql restart

    1

如果显示以下状态说明mysql安装成功。

这里写图片描述
/home/bhj/图片/mysql启动.jpeg

此时数据库安装成功,但是只能本地访问,不能远程访问数据库,如果要远程访问则必须进行设置。首先修改mysql的配置文件。

vim /etc/mysql/my.cnf

    1

找到bind-address,在前面加上#进行注释,如图所示。

这里写图片描述
/home/bhj/图片/mysql启动结果.jpeg


然后进行远程授权,先登录mysql。

mysql -uroot -proot

    1

注意这里的-p后面的root修改成你自己的密码。

然后输入命名进行授权。

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;

    1

注意:youpassword修改成你mysql的密码。

然后刷新一下权限。

FLUSH PRIVILEGES

    1

最后重启mysql就可以了。

service mysql restart

 

 

 

>>>>>>>>>>>>>>>>>>>>redis<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>redis<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>redis<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>redis<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>redis<<<<<<<<<<<<<<<<<<<<
 
在 Ubuntu 系统安装 Redi 可以使用以下命令:
?
1
    
$sudo apt-get update $sudo apt-get install redis-server

启动 Redis
?
1
    
$ redis-server

查看 redis 是否启动?
?
1
    
$ redis-cli

以上命令将打开以下终端:
?
1
    
redis 127.0.0.1:6379>

127.0.0.1 是本机 IP ,6379 是 redis 服务端口。现在我们输入 PING 命令。
?
1
    
redis 127.0.0.1:6379> ping PONG


更多
2
redis

如果是用apt-get或者yum install安装的redis,可以直接通过下面的命令停止/启动/重启redis

/etc/init.d/redis-server stop
/etc/init.d/redis-server start
/etc/init.d/redis-server restart

如果是通过源码安装的redis,则可以通过redis的客户端程序redis-cli的shutdown命令来重启redis

redis-cli -h 127.0.0.1 -p 6379 shutdown

如果上述方式都没有成功停止redis,则可以使用终极武器 kill -9

相关内容

    暂无相关文章