Thanks to visit codestin.com
Credit goes to github.com

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学习笔记

Keys

  • 常用内存分析命令
  • 系统架构
  • 命令分类

常用命令

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

mac 环境

mac book pro

https://download.oracle.com/java/21/latest/jdk-21_macos-x64_bin.tar.gz

https://www.cnblogs.com/dzqdzq/p/15039970.html


1.  通过dmg安装Java,可能的路径是

  目录1:/Users/dzq/Library/Java/JavaVirtualMachines/

  目录2:/Library/Java/JavaVirtualMachines/

2. 通过brew 方式安装openjdk

 实际目录:/usr/local/Cellar/openjdk..

 软链接目录: /usr/local/opt/openjdk..

再说一下Mac默认的Java程序:

目录1: /usr/bin/java

目录2:/usr/libexec/java_home

创建用户

useradd bage

passwd bage

Bage.123

Bage.123

JDK

安装jdk 8

https://www.digitalocean.com/community/tutorials/how-to-install-java-on-centos-and-fedora

jdk 17

https://computingforgeeks.com/install-java-openjdk-17-on-centos-rhel-7/

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]"

Mac
ssh-keygen -t ed25519 -C "[email protected]"

拷贝公钥

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

ssh-keygen -t ed25519 -C "[email protected]"
cat /Users/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

MySQL

参考链接 https://www.geeksforgeeks.org/how-to-install-mysql-on-linux/

install

[root@VM-28-9-centos lighthouse]# yum install mysql-server

No package mysql-server available.

https://serverfault.com/questions/662741/yum-no-package-mysql-server-available-in-cent-os-7

Yum update

yum install mysql-server mysql
yum install mariadb-server mariadb-libs mariadb

启动

mysql --version

systemctl start mariadb.service

确认安装完成

mysql --version

mysql_secure_installation

mysql

Bage1234.

bage1234.