|
| 1 | +# 安全研究员的Linux配置完全指南 |
| 2 | + |
| 3 | +文档最新更新请访问:[https://github.com/feicong/re-docs/edit/master/Linux-fedora-arm64.md](https://github.com/feicong/re-docs/edit/master/Linux-fedora-arm64.md) |
| 4 | + |
| 5 | +## 选择合适的Linux发行版 |
| 6 | + |
| 7 | +这里选择的是asahi的Fedora 42 Linux。 |
| 8 | + |
| 9 | +```bash |
| 10 | +uname -a |
| 11 | +Linux fedora 6.14.2-401.asahi.fc42.aarch64+16k #1 SMP PREEMPT_DYNAMIC Wed Apr 16 12:06:15 UTC 2025 aarch64 GNU/Linux |
| 12 | +cat /proc/version |
| 13 | +Linux version 6.14.2-401.asahi.fc42.aarch64+16k (mockbuild@844819db4c624c04819b557088679991) (gcc (GCC) 15.0.1 20250329 (Red Hat 15.0.1-0), GNU ld version 2.44-3.fc42) #1 SMP PREEMPT_DYNAMIC Wed Apr 16 12:06:15 UTC 2025 |
| 14 | +``` |
| 15 | + |
| 16 | +## 基础环境配置 |
| 17 | + |
| 18 | +首先配置系统的密码免输入与dnf源加速,参考:https://mirrors.tuna.tsinghua.edu.cn/help/fedora/ |
| 19 | + |
| 20 | +```bash |
| 21 | +ARCH="$(uname -m)" |
| 22 | + |
| 23 | +# 检查当前系统版本是否为 noble |
| 24 | +OS_VERSION=$(lsb_release -cs) |
| 25 | +if [ "$OS_VERSION" != "adams" ]; then |
| 26 | + echo "This script is designed for Fedora adams. Exiting." |
| 27 | + exit 1 |
| 28 | +fi |
| 29 | + |
| 30 | +echo "$(whoami) ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/$(whoami) |
| 31 | +sudo visudo -cf /etc/sudoers.d/$(whoami) |
| 32 | + |
| 33 | +sudo sed -e 's|^metalink=|#metalink=|g' \ |
| 34 | + -e 's|^#baseurl=http://download.example/pub/fedora/linux|baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora|g' \ |
| 35 | + -i.bak \ |
| 36 | + /etc/yum.repos.d/fedora.repo \ |
| 37 | + /etc/yum.repos.d/fedora-updates.repo |
| 38 | +sudo dnf makecache |
| 39 | +``` |
| 40 | + |
| 41 | +### 更新系统 |
| 42 | + |
| 43 | +```bash |
| 44 | +sudo dnf check-update |
| 45 | +``` |
| 46 | + |
| 47 | +### 安装必备工具 |
| 48 | + |
| 49 | +```bash |
| 50 | +sudo dnf install curl wget make upx vim openssl adb fastboot gh git git-lfs cmake python3 python3-pip \ |
| 51 | + flex bison make tree net-tools ninja-build meson pkg-config libtool autoconf automake help2man llvm \ |
| 52 | + grep plantuml aria2 bash bash-completion bc binutils brotli jq repo reprepro coreutils httpie lz4 \ |
| 53 | + shared-mime-info dbus lzip ffmpeg file flac tcpdump fontconfig texinfo gawk ca-certificates gettext \ |
| 54 | + unifdef sed gnupg gperf z3 zstd p7zip binwalk maven lsb-release patchelf gcc gdb tzdata socat \ |
| 55 | + ltrace strace gnome-tweaks net-tools openssh-server dnsutils pahole protobuf node go just docker \ |
| 56 | + wireshark qemu bridge-utils qemu-kvm libzip fzf htop java-21-openjdk -y |
| 57 | +``` |
| 58 | + |
| 59 | +手动安装下面的工具: |
| 60 | + |
| 61 | +```bash |
| 62 | +# https://code.visualstudio.com/docs/setup/linux |
| 63 | +sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc |
| 64 | +echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\nautorefresh=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null |
| 65 | +sudo dnf update && sudo dnf install code -y |
| 66 | + |
| 67 | +wget https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v2.4.1/Clash.Verge-2.4.1-1.aarch64.rpm |
| 68 | +sudo dnf install ./Clash.Verge-*.rpm -y |
| 69 | + |
| 70 | +wget https://dldir1v6.qq.com/qqfile/qq/QQNT/Linux/QQ_3.2.19_250904_aarch64_01.rpm # https://im.qq.com/linuxqq/index.shtml |
| 71 | +sudo dnf install ./QQ_*.rpm -y |
| 72 | + |
| 73 | +wget https://dldir1v6.qq.com/weixin/Universal/Linux/WeChatLinux_arm64.rpm # https://linux.weixin.qq.com/ |
| 74 | +sudo dnf install ./WeChatLinux_*.rpm -y |
| 75 | +``` |
| 76 | + |
| 77 | +### 配置docker |
| 78 | + |
| 79 | +```bash |
| 80 | +sudo usermod -aG docker $USER |
| 81 | +newgrp docker |
| 82 | +sudo mkdir -p /etc/docker |
| 83 | +sudo vim /etc/docker/daemon.json |
| 84 | + |
| 85 | +{ |
| 86 | + "registry-mirrors": [ |
| 87 | + "https://docker.1ms.run", |
| 88 | + "https://docker.xuanyuan.me", |
| 89 | + "https://dockerhub.timeweb.cloud", |
| 90 | + "http://mirrors.ustc.edu.cn/", |
| 91 | + "http://mirror.azure.cn/", |
| 92 | + "https://docker.m.daocloud.io" |
| 93 | + ] |
| 94 | +} |
| 95 | +``` |
| 96 | + |
| 97 | +运行测试 |
| 98 | + |
| 99 | +```bash |
| 100 | +sudo systemctl restart docker |
| 101 | +docker pull ubuntu:24.04 |
| 102 | +``` |
| 103 | + |
| 104 | +### 设置Python环境 |
| 105 | + |
| 106 | +```bash |
| 107 | +pip3 install --upgrade pip |
| 108 | +``` |
| 109 | + |
| 110 | +## 开发环境配置 |
| 111 | + |
| 112 | +### Java配置 |
| 113 | + |
| 114 | +选择Java版本。 |
| 115 | + |
| 116 | +```bash |
| 117 | +sudo alternatives --config java |
| 118 | +``` |
| 119 | + |
| 120 | +### 环境变量配置 |
| 121 | + |
| 122 | +添加环境变量到 `~/.bashrc`: |
| 123 | + |
| 124 | +```bash |
| 125 | +export JAVA_HOME=/usr/lib/jvm/java-21-openjdk |
| 126 | +export PATH=$PATH:$JAVA_HOME/bin |
| 127 | +``` |
| 128 | + |
| 129 | +生效: |
| 130 | + |
| 131 | +```bash |
| 132 | +source ~/.bashrc |
| 133 | +``` |
| 134 | + |
| 135 | +## 逆向分析工具 |
| 136 | + |
| 137 | +### 反编译和调试工具 |
| 138 | + |
| 139 | +```bash |
| 140 | +pip3 install frida-tools --break-system-packages |
| 141 | +``` |
| 142 | + |
| 143 | +### IDA Pro / Ghidra |
| 144 | + |
| 145 | +- 下载并安装 **Ghidra**(开源) |
| 146 | + |
| 147 | +- Ghidra 安装: |
| 148 | + |
| 149 | +```bash |
| 150 | +wget https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.4.2_build/ghidra_11.4.2_PUBLIC_20250826.zip |
| 151 | +unzip ghidra_*.zip -d $HOME/tools |
| 152 | +``` |
| 153 | + |
| 154 | +## 配置 |
| 155 | + |
| 156 | +一些软件需要配置登陆与设置代理。 |
| 157 | + |
| 158 | +### gh |
| 159 | + |
| 160 | +这个是github官方的命令行工具,管理仓库贼方便。登陆后就可以使用了。 |
| 161 | + |
| 162 | +```bash |
| 163 | +gh auth login |
| 164 | +``` |
| 165 | + |
| 166 | +### vscode配置 |
| 167 | + |
| 168 | +参考[macOS的vscode配置](https://github.com/feicong/re-docs/blob/master/macOS.md#vscode%E9%85%8D%E7%BD%AE) |
| 169 | + |
| 170 | +### golang |
| 171 | + |
| 172 | +```bash |
| 173 | +go env -w GOPROXY=https://goproxy.cn,direct |
| 174 | +``` |
| 175 | + |
| 176 | +### pip |
| 177 | + |
| 178 | +设置pip的mirror。 |
| 179 | + |
| 180 | +```bash |
| 181 | +pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple |
| 182 | +pip install -U pip --break-system-packages |
| 183 | +``` |
| 184 | + |
| 185 | +### npm |
| 186 | + |
| 187 | +设置npm的mirror。 |
| 188 | + |
| 189 | +```bash |
| 190 | +mkdir ~/.npm-global |
| 191 | +npm config set prefix '~/.npm-global' |
| 192 | +npm config set registry https://registry.npmmirror.com |
| 193 | +``` |
| 194 | + |
| 195 | +安装一些js工具。 |
| 196 | + |
| 197 | +```bash |
| 198 | +npm install -g @anthropic-ai/claude-code @google/gemini-cli typescript |
| 199 | +``` |
| 200 | + |
| 201 | +### maven |
| 202 | + |
| 203 | +```bash |
| 204 | +mkdir -p ~/.m2 |
| 205 | + |
| 206 | +echo '<?xml version="1.0" encoding="UTF-8"?> |
| 207 | +<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="settings.xsd"> |
| 208 | + <mirrors> |
| 209 | + <mirror> |
| 210 | + <id>aliyunmaven</id> |
| 211 | + <mirrorOf>*</mirrorOf> |
| 212 | + <name>阿里云公共仓库</name> |
| 213 | + <url>https://maven.aliyun.com/repository/public</url> |
| 214 | + </mirror> |
| 215 | +
|
| 216 | + <mirror> |
| 217 | + <id>huaweicloud</id> |
| 218 | + <mirrorOf>*</mirrorOf> |
| 219 | + <url>https://repo.huaweicloud.com/repository/maven/</url> |
| 220 | + </mirror> |
| 221 | +
|
| 222 | + <mirror> |
| 223 | + <id>nexus-163</id> |
| 224 | + <mirrorOf>*</mirrorOf> |
| 225 | + <name>Nexus 163</name> |
| 226 | + <url>http://mirrors.163.com/maven/repository/maven-public/</url> |
| 227 | + </mirror> |
| 228 | +
|
| 229 | + <mirror> |
| 230 | + <id>nexus-tencentyun</id> |
| 231 | + <mirrorOf>*</mirrorOf> |
| 232 | + <name>Nexus tencentyun</name> |
| 233 | + <url>http://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url> |
| 234 | + </mirror> |
| 235 | + </mirrors> |
| 236 | +</settings>' > ~/.m2/settings.xml |
| 237 | +``` |
| 238 | + |
| 239 | +maven项目中,执行`mvn install`命令即可看到效果。 |
0 commit comments