[rockylinux]:rockylinux10的基本配置
一、 PS1 配置
1. 配置位置( /etc/profile.d/bash-color-prompt.sh )
[root@rocky:profile.d]# pwd
/etc/profile.d
[root@rocky:profile.d]#
[root@rocky:profile.d]#
[root@rocky:profile.d]# cat bash-color-prompt.sh
# see /usr/share/doc/bash-color-prompt/README.md
## to truncate \w dirpath set:
# PROMPT_DIRTRIM=3
# only set for color terminals and if PS1 unchanged from bash or fedora defaults
if [ -n "${BASH_VERSION}" -a '(' "$PS1" = "[\u@\h \W]\\$ " -o "$PS1" = "\\s-\\v\\\$ " ')' -a '(' "${TERM: -5}" = "color" -o "${TERM}" = "linux" ')' -o -n "${bash_prompt_color_force}" ]; then
PROMPT_COLOR="${PROMPT_COLOR:-32}"
PROMPT_USERHOST="${PROMPT_USERHOST:-\u@\h}"
PROMPT_SEPARATOR="${PROMPT_SEPARATOR:-:}"
#PROMPT_DIRECTORY="${PROMPT_DIRECTORY:-\w}"
PROMPT_DIRECTORY="${PROMPT_DIRECTORY:-\W}"
# config by david at 20250824
PROMPT_START='['
PROMPT_END=']'
colorpre='\[\e['
colorsuf='m\]'
colorreset="${colorpre}0${colorsuf}"
PS1='${PROMPT_START@P}'"${colorpre}"'${PROMPT_COLOR}'"${colorsuf}"'${PROMPT_USERHOST@P}'"${colorreset}"'${PROMPT_SEPARATOR@P}'"${colorpre}"'${PROMPT_DIR_COLOR:-${PROMPT_COLOR}}'"${colorsuf}"'${PROMPT_DIRECTORY@P}'"${colorreset}"'${PROMPT_END@P}\$'"${colorreset} "
prompt_default() {
PROMPT_COLOR="$1"
PROMPT_DIR_COLOR="$2"
PROMPT_SEPARATOR=':'
PROMPT_DIRECTORY='\w'
PROMPT_START=''
PROMPT_END=''
}
prompt_traditional() {
PROMPT_COLOR="${1:-0}"
PROMPT_DIR_COLOR="$2"
PROMPT_SEPARATOR=' '
PROMPT_DIRECTORY='\W'
PROMPT_START='['
PROMPT_END=']'
}
prompt_default_os() {
eval "$(grep ANSI_COLOR /etc/os-release)"
PROMPT_COLOR="$ANSI_COLOR"
PROMPT_DIR_COLOR="$1"
PROMPT_SEPARATOR=':'
PROMPT_DIRECTORY='\w'
PROMPT_START=''
PROMPT_END=''
}
fi
[root@rocky:profile.d]#
[root@rocky:profile.d]#
二、 SSH配置
1. selinux配置(/etc/selinux/config)
#SELINUX=enforcing
SELINUX=disabled
2. firewalld配置
[root@rocky:selinux]# firewall-cmd --zone=public --add-port=22/tcp --permanent
[root@rocky:selinux]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
[root@rocky:selinux]# firewall-cmd --reload
[root@rocky:selinux]# firewall-cmd --zone=public --list-ports
22/tcp 3306/tcp
三、 root_bashrc配置( /root/.bashrc )
1. ~/.bashrc ( /root/.bashrc )
[root@rocky:~]# cat ~/.bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# [david-config-20250824]
alias off='poweroff '
alias updateos='dnf clean all -y && dnf makecache -y && dnf upgrade -y '
alias gpp='g++ -g -Wall '
alias gcc='gcc -g -Wall '
alias vi='vim '
#[rust_config] 2025-08-25 config by david
export RUSTUP_UPDATE_ROOT='https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup'
export RUSTUP_DIST_SERVER='https://mirrors.tuna.tsinghua.edu.cn/rustup'
. "$HOME/.cargo/env"
[root@rocky:~
四、 我安装软件
1. NASM_INSTALL
-- nasm.repo( /etc/yum.repos.d/nasm.repo )
-- cd /etc/yum.repos.d/ && curl -O https://www.nasm.us/nasm.repo
-- https://www.nasm.us/nasm.repo
-- dnf install nasm
2. RUST_INSTALL
-- RUST_CONFIG
[root@rocky:~]# cat /root/.bashrc
#[rust_config] 2025-08-25 config by david
export RUSTUP_UPDATE_ROOT='https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup'
export RUSTUP_DIST_SERVER='https://mirrors.tuna.tsinghua.edu.cn/rustup'
-- RUST_INSTALL
[root@rocky:~]# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
五、 参考
1. 无
.
本文由 lnlidawei 原创、整理、转载,本文来自于【博客园】; 整理和转载的文章版权归属【原创作者】; 转载或引用时【请保留文章的来源信息】:https://www.cnblogs.com/lnlidawei/p/19057261

浙公网安备 33010602011771号