alpine 常用操作

1.安装默认文件
2.安全配置,SSH
参考
https://wiki.alpinelinux.org/wiki/Fail2ban

Install

This will install fail2ban package. It includes iptables package (see also Configure_Networking#Firewalling_with_iptables_and_ip6tables)

apk add fail2ban

Enable the fail2ban service so that it starts at boot:
这里可以在重启后再执行,以防止 fail2ban 启动后就把自己的IP禁止了~~

rc-update add fail2ban

Start the fail2ban service immediately and create configuration files:

rc-service fail2ban start

List services to verify fail2ban is enabled:

rc-status

Configuration

  • Configuration files are located at /etc/fail2ba

查询登录失败的信息

grep 'Failed password' /var/log/messages

查看被禁止登录的IP

fail2ban-client status sshd

 

gradlew 命令行下使用代理

set SOCKS_PROXY=socks5://127.0.0.1:2080

gradlew build

1. 启用 Gradle Daemon

Gradle Daemon 是一个后台进程,可以显著减少构建时间。你可以在 gradle.properties 文件中启用它:

org.gradle.daemon=true

2. 并行构建

启用并行构建可以利用多核处理器的优势,加快编译速度:

org.gradle.parallel=true

3. 离线模式

如果你不需要下载新的依赖,可以启用离线模式来加快构建:

gradlew build –offline

4. 使用最新版本的 Gradle

确保你使用的是最新版本的 Gradle,因为每个新版本通常都会包含性能改进。你可以通过以下命令更新 Gradle Wrapper:

gradlew wrapper –gradle-version <latest-version>

5. 配置缓存

启用构建缓存可以减少重复任务的执行时间:

org.gradle.caching=true

 

 

gradlew 是 Gradle Wrapper 的缩写,它对 Gradle 的命令进行了包装,使得你可以在没有安装 Gradle 的情况下运行 Gradle 构建。以下是一些常用的 gradlew 命令:

常用命令
帮助和版本信息
gradlew -h 或 gradlew –help:显示帮助信息。
gradlew -v 或 gradlew –version:显示 Gradle 版本信息。

任务管理
gradlew tasks:列出所有可用任务。
gradlew tasks –all:列出所有任务,包括隐藏任务。

构建和清理
gradlew build:编译并打包项目。
gradlew clean:清理构建目录。
gradlew assemble:编译项目但不运行测试。
gradlew check:运行所有检查任务,包括测试。

依赖管理
gradlew dependencies:显示项目的依赖关系。
gradlew dependencyInsight –dependency <dependency-name>:显示特定依赖的详细信息。

调试和日志
gradlew build –info:显示详细的构建信息。
gradlew build –debug:显示调试信息。
gradlew build –stacktrace:显示错误的堆栈跟踪信息。

编译项目

要编译一个项目,你可以使用以下步骤:
初始化项目
如果你还没有一个 Gradle 项目,可以使用以下命令初始化:
gradlew init

编译项目
在项目根目录下运行以下命令来编译项目:
gradlew build
这将会编译项目的所有源代码,并生成相应的构建输出。

运行测试
如果你想运行测试,可以使用以下命令:

gradlew test
打包应用
如果你需要生成一个可执行的 JAR 文件,可以使用以下命令:
gradlew jar

module ‘luci.ucodebridge’ not found 解决

解决方法
1. ssh 登录到路由器,
2. 执行

opkg install luci-lua-runtime

3. 可选执行

opkg install luci-app-uhttpd
module ‘luci.ucodebridge’ not found: no field package.preload[‘luci.ucodebridge’] no file ‘./luci/ucodebridge.lua’ no file ‘/usr/share/lua/luci/ucodebridge.lua’ no file ‘/usr/share/lua/luci/ucodebridge/init.lua’ no file ‘/usr/lib/lua/luci/ucodebridge.lua’ no file ‘/usr/lib/lua/luci/ucodebridge/init.lua’ no file ‘./luci/ucodebridge.so’ no file ‘/usr/lib/lua/luci/ucodebridge.so’ no file ‘/usr/lib/lua/loadall.so’ no file ‘./luci.so’ no file ‘/usr/lib/lua/luci.so’ no file ‘/usr/lib/lua/loadall.so’ In [anonymous function](), file [C]
In [anonymous function](), file /usr/share/ucode/luci/runtime.uc, line 133, byte 10:
  called from function [arrow function] (/usr/share/ucode/luci/runtime.uc:141:63)
  called from function render ([C])
  called from function [anonymous function] (/usr/share/ucode/luci/runtime.uc:141:64)
  called from function run_action (/usr/share/ucode/luci/dispatcher.uc:778:34)
  called from function [anonymous function] (/usr/share/ucode/luci/dispatcher.uc:1003:48)
  called from anonymous function (/www/cgi-bin/luci:39:13)

 `            die(ex);`
  Near here --------^