plantuml常用汇总
linux 上中文文字层叠现象
ubuntu
sudo apt-get install ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy
centos
sudo yum install -y wqy-microhei-fonts
sudo yum install -y adobe-source-han-sans-cn-fonts
sudo apt-get install ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy
sudo yum install -y wqy-microhei-fonts
sudo yum install -y adobe-source-han-sans-cn-fonts
linux 字体安装
1.将字体下载并拷贝到对应文件夹中,并进入字体文件夹
cp *.ttf /usr/share/fonts
cd /usr/share/fonts
2.字体安装器
sudo apt install ttf-mscorefonts-installer
# (创建字体的fonts.scale文件,它用来控制字体旋转缩放)
sudo mkfontscale
# (创建字体的fonts.dir文件,它用来控制字体粗斜体产生)
sudo mkfontdir
3.建立字体缓存
sudo apt install fontconfig
# 建立字体缓存信息
sudo fc-cache -fv
# 查看已经安装的
fc-list
https://github.com/ohmyzsh/ohmyzsh
https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins
1.zsh-autosuggestions 自动补全插件
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
2.高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
3.autojump
sudo apt-get install autojump
plugins=(
git
z
autojump
zsh-autosuggestions
zsh-syntax-highlighting
sudo
)
https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
https://github.com/romkatv/powerlevel10k
如果使用 EPEL 存储库中的 dnf 安装 Git 仍然无法得到最新版本的 Git,您可以考虑从源代码编译安装 Git。以下是在 CentOS 7 上编译安装最新版本 Git 的步骤:
打开终端并使用 root 用户登录系统。
安装必需的编译工具和依赖项:
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -y
前往 Git 官网的下载页面(https://git-scm.com/downloads) 并找到最新版本的 Git。复制该版本的下载链接。
在终端中使用以下命令下载 Git 的源代码压缩包(请将命令中的 URL 替换为第 3 步中复制的下载链接):
curl -LO https://github.com/git/git/archive/refs/tags/v2.40.1.tar.gz
tar xzf *.gz
cd git-*
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo 'export PATH=$PATH:/usr/local/git/bin' >> ~/.bashrc
source ~/.bashrc
git --version
如果 Git 版本号显示为最新版本,则表示 Git 已经成功安装在 CentOS 7 上。请注意,由于 CentOS 7 默认使用较旧的软件版本,因此您可能需要升级其他依赖项来满足 Git 的要求。如果在编译过程中遇到任何问题,请检查错误消息并尝试解决它们。
windows git 上有分支名称,一下加入可让 linux 也支持分支名称
vim ~/.bashrc
function git-branch-name {
git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3
}
function git-branch-prompt {
local branch=`git-branch-name`
if [ $branch ]; then printf " [%s] " $branch; fi
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(git-branch-prompt)\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(git-branch-prompt)\$ '
fi
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\[\033[36m\]\u@\h\[\033[m\]:\[\033[32m\]\w\[\033[m\]\$(parse_git_branch)\$ "
vim /home/[username]/.gitconfig
[color]
status = auto
diff = auto
ui = true
interactive = auto
branch = auto
修改后立马生效
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.ui true
git config --global color.interactive auto
git remote -v
本地建立仓库,远程后建立,拉取时会失败,使用以下命令强制拉取
git pull <远程仓库地址> -allow-unrelated-histories
git branch --set-upstream-to=origin/<远程分支名称>
git push origin --delete origin/<远程分支名称>
git reset --hard <commit>
// 方式1
git push origin HEAD --force
// 方式2
git push --force
git revert <commit> // 回退作为一个动作保留
git push // 这样作为一个同步提交不会造成服务器的冲突了
git remote set-url origin 【url】
或者
git remote remove origin
git remote add origin【url】
git clone -b <branch> <remote_repo>
fetch <仓库路径>
git cherry-pick <版本号> # 也可以是分支名称
$ git tag
$ git tag -a v1.0 -m "xxx"
```\ $ git tag -l "v1.0*"
#### 3.4 显示对应标签所有信息
#### 3.5 删除标签
## git submodule
### 添加子模块
```sh
git submodule add <submodule> <path>
git submodule update --init --recursive
git submodule deinit <path>
git rm <path>
如果已经update 了,还要删除 .git里面module的对应内容
先删除再添加
git 1.8.5 之后新增, 建议先删除再新增子模块
git mv {oldPath} {newPath}
# 如果要更换submodule 名称与 path 一致
mv .git/modules/{oldPath} .git/modules/{newPath}
nvs 详细安装可以去 github:
https://github.com/jasongin/nvs
如果使用 git base 环境, 在 ~/.bash_profile 加入以下命令
export NVS_HOME=$LOCALAPPDATA/nvs
. $NVS_HOME/nvs.sh
如果为wsl环境, 如果windows中无nvs环境可跳过此步骤
vim ~/.bashrc
在文件末尾加入,排出windows nvs 环境变量, 具体路径参考自己 windows 的 nvs 环境
export PATH=$(echo $PATH | sed -e 's;:/mnt/c/Users/<user>/AppData/Local/nvs/default;;' -e 's;:/mnt/c/Users/<user>/AppData/Local/nvs/;;')
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
推荐直接使用 pnpm 替代
pnpm config set prefix ~/.npm-global
配置到环境变量到 ~/.bashrc, windows类似在系统配置中添加
export PATH=~/.npm-global/bin:$PATH
查看 remote
nvs remote
配置镜像地址
nvs remote node https://npmmirror.com/mirrors/node/
1.查看硬盘
root@ubuntu:~# fdisk -lu
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x3c78b7a1
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 16777215 16775168 8G 83 Linux
/dev/sda2 16779262 20969471 4190210 2G 5 Extended
/dev/sda5 16779264 20969471 4190208 2G 82 Linux swap / Solaris
Partition 2 does not start on physical sector boundary.
Disk /dev/sdb: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
2.创建分区
root@ubuntu:~# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xdf96fde2.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-104857599, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-104857599, default 104857599):
Created a new partition 1 of type 'Linux' and of size 50 GiB.
Command (m for help): p
Disk /dev/sdb: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xdf96fde2
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 104857599 104855552 50G 83 Linux
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
3.格式化分区
root@ubuntu:~# mkfs.ext4 /dev/sdb1
mke2fs 1.42.13 (17-May-2015)
Discarding device blocks: 完成
Creating filesystem with 13106944 4k blocks and 3276800 inodes
Filesystem UUID: c0887faa-eed2-4f38-9f18-6e3059261202
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
4.挂载和查看分区表
root@ubuntu:~# mount /dev/sdb1 /data
root@ubuntu:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 395M 5.5M 389M 2% /run
/dev/sda1 7.8G 1.2G 6.2G 16% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
tmpfs 395M 0 395M 0% /run/user/0
/dev/sdb1 50G 52M 47G 1% /data
5.永久挂载
# 执行前一定要进行备份,以免误操作
echo '/dev/sdb1 /data ext4 defaults 0 0' >> /etc/fstab
eg: 将 docker lib 目录映射到 /data/lib/docker
echo '/data/lib/docker /var/lib/docker none defaults,bind 0 0'>>/etc/fstab
mount -a
# 打印系统信息
$ uname -a
Linux LAPTOP-2181LTT2 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
# 获取发行版信息
$ cat /etc/issue
Ubuntu 18.04.6 LTS \n \l
$ cat /etc/issue.net
Ubuntu 18.04.6 LTS
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
# 根据上面 ID_LIKE 来获取version
$ cat /etc/debian_version
9.3
# 也可直接通过system 获取(如果有)
$ cat /etc/system-release
9.3
# 获取内核版本
$ cat /proc/version
Linux version 5.4.72-microsoft-standard-WSL2 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Oct 28 23:40:43 UTC 2020
# dmesg 命令
$ dmesg | grep "Linux"
[ 0.000000] Linux version 5.4.72-microsoft-standard-WSL2 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Oct 28 23:40:43 UTC 2020
[ 3.522133] ACPI: Added _OSI(Linux-Dell-Video)
[ 3.527064] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[ 3.531431] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
# 其他 Yum/Dnf
$ yum info nano
$ yum repolist
$ dnf info nano
$ apt-cache policy nano
nano:
Installed: 2.9.3-2
Candidate: 2.9.3-2
Version table:
*** 2.9.3-2 500
500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
100 /var/lib/dpkg/status
1.conf.d/default.conf 默认域名,若没命中,进入此处
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html/default;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
1.conf.d/www.my.com.conf www.my.com 和 my.com 进入会命中
server {
listen 80;
listen [::]:80;
server_name www.my.com my.com;
location / {
root /usr/share/nginx/html/my;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
server {
listen 80; # 监听 HTTP 请求的端口,可以根据需要更改
server_name files.localhost; # 你的服务器名称或 IP 地址
location / {
alias /files/; # 指定文件存储目录
autoindex on; # 启用自动列出目录内容
autoindex_exact_size off; # 显示文件大小的近似值
charset utf-8;
}
}
htpasswd文件生成printf "test:$(openssl passwd -crypt 123456)\n" >> /usr/local/nginx-1.5.1/conf/basicauth
server{
listen 80;
server_name auth.localhost;
location / {
root html;
auth_basic "Please enter your username and password";
auth_basic_user_file ../conf/basicauth;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
在配置文件/etc/samba/smb.conf中
#共享文件设置参数
[share] #自定义共享名称,共享路径对应显示的实际名称,常用项
comment = This is share software #共享描述,做一个说明
path = /home/testfile #共享目录路径
browseable = yes/no #设置共享是否可浏览,如果no就表示隐藏,需要通过IP+共享名称进行访问
writable = yes/no #设置共享是否具有可写权限
read only = yes/no #设置共享是否具有只读权限
admin users = root #设置共享的管理员,如果security =share 时,引项无效,多用户中间使用逗 号隔开,例如admin users = root,user1,user2
# 设置允许访问共享的用户,例如valid users = user1,user2,@group1,@group2(多用户或组使用逗号隔
# 开,@group表示group用户组)
valid users = username
invalid users = username #设置不允许访问共享的用户
# 设置在共享具有写入权限的用户,例如例如write list = user1,user2,@group1,@group2(多用户或组使
# 用逗号隔开,@group表示group用户组)
write list = username
public = yes/no #设置共享是否允许guest账户访问
guest ok = yes/no #功能同public 一样
create mask = 0700 #创建的文件权限为700
directory mode = 0700 #创建的文件目录为 700
force user = ubuntu #客户端默认创建所属用户,设置后防止windows访问成为nobody, 常用项
smbpasswd -a ubuntu // 将ubuntu添加到samba用户组
配置操作后需重启服务
ubuntu
sudo /etc/init.d/smbd restart
centos
graph TD
A["cmd:gpedit.msc"]
--> B["管理模板"]
B --> C["网络"]
C --> D["lanman工作站"]
D --> E["启用不安全的来宾登陆:已启用"]
确保setlinux关闭,可以用setenforce 0命令执行。 默认的,SELinux禁止网络上对Samba服务器上的共享目录进行写操作,即使你在smb.conf中允许了这项操作。 /usr/bin/setenforce 修改SELinux的实时运行模式
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式
如果要彻底禁用SELinux 需要在/etc/sysconfig/selinux中设置参数selinux=0 ,或者在/etc/grub.conf中添加这个参数
/usr/bin/setstatus -v
?? 不关闭防火墙方法
setsebool -P samba_enable_home_dirs on
setsebool -P samba_domain_controller on
#/usr/sbin/setsebool -P allow_smbd_anon_write=1
#chcon -t public_content_rw_t <共享文件路径>