Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

    chmod 700 ~/.ssh/

study-linux

Linux学习笔记

常用命令

grep命令基本用法

软件安装

JDK+Maven

添加环境变量

vi .bash_profile

末尾追加如下内容, JAVA_HOME、MAVEN_HOME你懂的,需要修改成自己的目录

export JAVA_HOME=/home/bage/professional/jdk1.8.0_131
export MAVEN_HOME=/home/bage/professional/apache-maven-3.6.1
export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

source 一下,使配置生效

source .bash_profile

Maven

Nginx 安装

./configure 缺少依赖pcre

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

处理方式

yum install pcre-devel

./configure 缺少依赖zlib

./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.

处理方式 yum install zlib-devel

安装

./configure

或者

./configure --prefix=/home/bage/professional/nginx-1.15.0

配置说明

location配置参考 https://www.cnblogs.com/coder-yoyo/p/6346595.html

  location = /uri      =    开头表示精确匹配,只有完全匹配上才能生效。
  location ^~ /uri     ^~   开头对URL路径进行前缀匹配,并且在正则之前。
  location ~ pattern    ~    开头表示区分大小写的正则匹配。
  location ~* pattern   ~*   开头表示不区分大小写的正则匹配。
  location /uri       /uri 不带任何修饰符,也表示前缀匹配,但是在正则匹配之后。
  location /         /    通用匹配,任何未匹配到其它location的请求都会匹配到,相当于switch中的default。

ActiveMQ

Linux下载

wget http://activemq.apache.org/path/tofile/apache-activemq-5.15.4-bin.tar.gz

加入安装路径

cd ${activemq_install_dir}
tar zxvf activemq-5.15.4-bin.tar.gz

启动

cd ${activemq_install_dir}/bin
./activemq start

Nodejs

Linux下载

加入安装路径

启动


Nexus

lrzsz

安装

yum install lrzsz 

上传文件

rz

rz -be 

SSH KEY

参考链接 https://help.github.com/articles/generating-an-ssh-key/https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

Steps

Open TerminalTerminalGit Bash. 略

Generating a new SSH key

ssh-keygen -t rsa -b 4096 -C "[email protected]"

拷贝公钥

cat /home/bage/.ssh/id_rsa.pub

配置多个(写入到另一个文件)

/home/bage/.ssh/id_rsa_another_one.pub

添加对应私钥

ssh-agent bash

ssh-add ~/.ssh/id_rsa_another_one

新建文本文件

    vi C:\Users\bage\.ssh\config	

内容 # 配置 github.com Host github.com
HostName github.com IdentityFile C:\Users\bage\.ssh\id_rsa_github PreferredAuthentications publickey User [email protected]

SFTP

参考链接 https://linuxeye.com/437.html

Steps

Open TerminalTerminalGit Bash. 略

切换到 root 用户

su 

查看openssh的版本,版本必须大于4.8

ssh -V 

创建sftp 用户组(名字建议就叫做sftp)

groupadd sftp

创建sftp文件目录

mkdir -p /data/sftp

设定Chroot目录权限

chown -R root:sftp /data/sftp
chmod 0755 /data/sftp

配置sshd_config(可以先备份文件)

// vi 编辑
vi /etc/ssh/sshd_config
// 注释掉 Subsystem 这一行 
# Subsystem     sftp    /usr/libexec/openssh/sftp-server
// 文末尾添加
Port 22
Subsystem sftp internal-sftp -l INFO -f AUTH
Match Group sftp
ChrootDirectory /data/sftp/%u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp -l INFO -f AUTH

设置SFTP用户 sftptest2 可写入的目录

mkdir /data/sftp/sftptest2
chmod 0755 /data/sftp/sftptest2
chown root:sftp /data/sftp/sftptest2
useradd -g sftp -s /sbin/nologin sftptest2

创建用户 sftptest2 的密钥对

mkdir -p /home/sftptest2/.ssh
ssh-keygen -t rsa
cp /root/.ssh/id_rsa.pub /home/sftptest2/.ssh/authorized_keys
chown -R sftptest2.sftp /home/sftptest2

创建一个可写目录 upload

mkdir /data/sftp/sftptest2/upload
chown -R sftptest2:sftp /data/sftp/sftptest2/upload

重启sshd 服务

systemctl restart sshd

连接验证

sftp -oidentityFile=/root/.ssh/id_rsa [email protected] -oport=22

修改文件权限

 //用户权限
chmod 700 /home/sftptest2
//.ssh文件夹权限
chmod 700 ~/.ssh/
// ~/.ssh/authorized_keys 文件权限
chmod 600 ~/.ssh/authorized_keys
systemctl restart sshd.service