Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
feee81fbae | |||
5821f13807 | |||
3c18602a00 | |||
d84ac67ffc | |||
5ae5b64798 | |||
42be50dca0 | |||
d0aa341ddf | |||
1c7ed5c2b7 | |||
a0cfa1751a | |||
2787209af6 | |||
ea7db931d7 | |||
6d6bece0a0 | |||
a525a0a0d2 | |||
579815f4b5 | |||
5b72f9abd7 | |||
44e86615e8 | |||
0872b872e2 | |||
1fc03f9cea | |||
a8aa954ba6 | |||
a056fc0365 | |||
69178f339d |
201
Init-Server.sh
Normal file
201
Init-Server.sh
Normal file
@ -0,0 +1,201 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define color codes
|
||||
GREEN='\e[32m'
|
||||
BLUE='\e[34m'
|
||||
YELLOW='\e[33m'
|
||||
NC='\e[0m' # No Color
|
||||
|
||||
# Function for consistent log messages
|
||||
log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
|
||||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||
log_skip() { echo -e "${YELLOW}[SKIPPED]${NC} $1"; }
|
||||
|
||||
# Function to check if a command exists
|
||||
command_exists() {
|
||||
command -v "$1" &> /dev/null
|
||||
}
|
||||
|
||||
# Function to handle user input with Y/n prompt
|
||||
get_user_confirmation() {
|
||||
local prompt="$1"
|
||||
local input
|
||||
log_info "$prompt (Y/n)"
|
||||
read -p "> " input
|
||||
[[ -z "$input" || "$input" =~ ^[Yy]$ ]]
|
||||
}
|
||||
|
||||
# Function to setup SSH directory and keys
|
||||
setup_ssh() {
|
||||
# Create .ssh directory if it doesn't exist
|
||||
if [ ! -d "$HOME/.ssh" ]; then
|
||||
mkdir -m 700 "$HOME/.ssh"
|
||||
log_success ".ssh-Verzeichnis wurde erstellt."
|
||||
else
|
||||
log_info ".ssh-Verzeichnis existiert bereits."
|
||||
fi
|
||||
|
||||
# Ask for SSH public key
|
||||
log_info "SSH-Public-Key eingeben (Leerlassen zum Überspringen)"
|
||||
read -p "> " user_input
|
||||
|
||||
if [ ! -z "$user_input" ]; then
|
||||
if grep -q "$user_input" "$HOME/.ssh/authorized_keys"; then
|
||||
log_info "Der SSH-Public-Key ist bereits vorhanden."
|
||||
else
|
||||
echo "$user_input" >> "$HOME/.ssh/authorized_keys"
|
||||
log_success "SSH-Public-Key wurde hinzugefügt."
|
||||
fi
|
||||
else
|
||||
log_skip "SSH-Key Installation übersprungen."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to update system packages
|
||||
update_system() {
|
||||
if get_user_confirmation "System aktualisieren?"; then
|
||||
log_info "System wird aktualisiert..."
|
||||
apt update && apt upgrade -y
|
||||
log_success "System wurde erfolgreich aktualisiert."
|
||||
else
|
||||
log_skip "System-Aktualisierung übersprungen."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to install Docker and Dockge
|
||||
install_docker() {
|
||||
if get_user_confirmation "Docker installieren?"; then
|
||||
if command_exists docker; then
|
||||
log_info "Docker ist bereits installiert."
|
||||
else
|
||||
log_info "Docker wird installiert..."
|
||||
# Install required packages
|
||||
apt install -y apt-transport-https ca-certificates curl software-properties-common
|
||||
|
||||
# Add Docker's official GPG key
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
|
||||
# Add Docker repository
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
# Update and install Docker
|
||||
apt update
|
||||
apt install -y docker-ce docker-ce-cli containerd.io
|
||||
|
||||
# Start and enable Docker
|
||||
systemctl start docker
|
||||
systemctl enable docker
|
||||
log_success "Docker wurde erfolgreich installiert."
|
||||
fi
|
||||
|
||||
# Install Dockge if Docker is available
|
||||
if command_exists docker; then
|
||||
if get_user_confirmation "Dockge (Docker Compose Manager) installieren?"; then
|
||||
log_info "Dockge wird installiert..."
|
||||
docker run -d --name=dockge -p 5001:5001 -v /var/run/docker.sock:/var/run/docker.sock louislam/dockge
|
||||
log_success "Dockge wurde erfolgreich installiert und läuft auf Port 5001."
|
||||
else
|
||||
log_skip "Dockge-Installation übersprungen."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
log_skip "Docker-Installation übersprungen."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to install Node.js
|
||||
install_nodejs() {
|
||||
if get_user_confirmation "Node.js installieren?"; then
|
||||
log_info "Node.js wird installiert/aktualisiert..."
|
||||
|
||||
# Install npm first
|
||||
apt install -y npm
|
||||
|
||||
# Update npm to latest version
|
||||
npm install -g npm@latest
|
||||
|
||||
# Install n module for Node.js version management
|
||||
npm install -g n
|
||||
|
||||
# Install latest stable Node.js version using n
|
||||
n stable
|
||||
|
||||
# Reload shell environment to use new Node.js version
|
||||
export PATH="$PATH"
|
||||
|
||||
log_success "Node.js wurde erfolgreich installiert/aktualisiert."
|
||||
log_info "Installed Node.js version: $(node --version)"
|
||||
log_info "Installed npm version: $(npm --version)"
|
||||
else
|
||||
log_skip "Node.js-Installation übersprungen."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to setup basic system tools and security
|
||||
setup_basic_system() {
|
||||
if get_user_confirmation "Basic tools und Firewall installieren?"; then
|
||||
log_info "Installiere basic tools und UFW..."
|
||||
apt install -y htop zip unzip ufw \
|
||||
screen vim nano git \
|
||||
curl wget tree ncdu \
|
||||
gcc g++ build-essential
|
||||
|
||||
# Configure UFW
|
||||
ufw allow ssh
|
||||
echo "y" | ufw enable
|
||||
|
||||
log_success "Basic tools und UFW wurden erfolgreich installiert."
|
||||
log_success "SSH-Verbindungen sind erlaubt."
|
||||
else
|
||||
log_skip "Basic tools und UFW Installation übersprungen."
|
||||
fi
|
||||
}
|
||||
# Function to display system overview
|
||||
display_system_overview() {
|
||||
log_info "=== System Overview ==="
|
||||
echo -e "\n${BLUE}[Network Information]${NC}"
|
||||
echo "IP Addresses:"
|
||||
ip -4 addr show | grep inet | awk '{print $2}' | cut -d/ -f1
|
||||
|
||||
echo -e "\n${BLUE}[Disk Usage]${NC}"
|
||||
df -h / | tail -n 1 | awk '{print "Root partition: " $4 " free of " $2}'
|
||||
|
||||
echo -e "\n${BLUE}[Memory Usage]${NC}"
|
||||
free -h | awk '/^Mem:/ {print "RAM: " $3 " used of " $2 " total"}'
|
||||
|
||||
echo -e "\n${BLUE}[CPU Information]${NC}"
|
||||
lscpu | grep "Model name" | cut -d: -f2- | sed 's/^[ \t]*//'
|
||||
echo "CPU Usage: $(top -bn1 | grep "Cpu(s)" | awk '{print $2}')%"
|
||||
|
||||
echo -e "\n${BLUE}[Installed Components]${NC}"
|
||||
if command_exists docker; then
|
||||
echo "✓ Docker $(docker --version | cut -d' ' -f3 | tr -d ',')"
|
||||
if docker ps | grep -q dockge; then
|
||||
echo "✓ Dockge (running on port 5001)"
|
||||
fi
|
||||
fi
|
||||
if command_exists node; then
|
||||
echo "✓ Node.js $(node --version)"
|
||||
fi
|
||||
if command_exists ufw; then
|
||||
echo "✓ UFW ($(ufw status | grep Status | cut -d' ' -f2))"
|
||||
fi
|
||||
echo -e "\n${BLUE}[Open Ports]${NC}"
|
||||
netstat -tuln | grep LISTEN | awk '{print $4}' | sed 's/.*://' | tr '\n' ', ' | sed 's/,$/\n/'
|
||||
|
||||
echo -e "\n${GREEN}Setup completed! System is ready to use.${NC}"
|
||||
echo -e "${YELLOW}Important: Please reconnect to your server via SSH to ensure all changes are properly applied.${NC}\n"
|
||||
}
|
||||
|
||||
# Main execution
|
||||
main() {
|
||||
setup_ssh
|
||||
update_system
|
||||
setup_basic_system
|
||||
install_docker
|
||||
install_nodejs
|
||||
display_system_overview
|
||||
}
|
||||
|
||||
# Run main function
|
||||
main
|
4
Init.sh
4
Init.sh
@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
read -p "Bitte gib einen Text ein: " user_input
|
||||
echo "Du hast eingegeben: $user_input"
|
113
README.md
113
README.md
@ -1,93 +1,42 @@
|
||||
# Linux Server Tools
|
||||
|
||||
curl -o /tmp/Init-Server.sh https://git.lucidtime.de/Hikyu/linux-server-tools/-/raw/dev/Init-Server.sh?ref_type=heads && bash /tmp/Init-Server.sh && rm /tmp/Init-Server.sh
|
||||
|
||||
## What this script does
|
||||
|
||||
## Getting started
|
||||
The script performs the following setup tasks:
|
||||
|
||||
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||
1. SSH Setup
|
||||
- Creates .ssh directory if needed
|
||||
- Adds provided SSH public key to authorized_keys
|
||||
|
||||
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
||||
2. System Updates
|
||||
- Updates package lists
|
||||
- Upgrades installed packages
|
||||
|
||||
## Add your files
|
||||
3. Basic Tools Installation
|
||||
- htop (Process monitoring)
|
||||
- zip/unzip
|
||||
- UFW (Firewall)
|
||||
- screen (Terminal multiplexer)
|
||||
- vim, nano (Text editors)
|
||||
- git (Version control)
|
||||
- curl, wget (Download tools)
|
||||
- tree (Directory visualization)
|
||||
- ncdu (Disk usage analyzer)
|
||||
|
||||
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
||||
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
||||
4. Security Configuration
|
||||
- Enables UFW firewall
|
||||
- Configures SSH access
|
||||
|
||||
```
|
||||
cd existing_repo
|
||||
git remote add origin http://5.249.168.81:8081/Hikyu/linux-server-tools.git
|
||||
git branch -M master
|
||||
git push -uf origin master
|
||||
```
|
||||
5. Docker Installation (Optional)
|
||||
- Installs Docker Engine
|
||||
- Sets up Docker repository
|
||||
- Configures Docker to start on boot
|
||||
|
||||
## Integrate with your tools
|
||||
6. Dockge Installation (Optional)
|
||||
- Installs Dockge container management
|
||||
- Runs on port 5001
|
||||
|
||||
- [ ] [Set up project integrations](http://5.249.168.81:8081/Hikyu/linux-server-tools/-/settings/integrations)
|
||||
|
||||
## Collaborate with your team
|
||||
|
||||
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
||||
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
||||
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
||||
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
||||
|
||||
## Test and Deploy
|
||||
|
||||
Use the built-in continuous integration in GitLab.
|
||||
|
||||
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
||||
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
||||
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
||||
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
||||
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
||||
|
||||
***
|
||||
|
||||
# Editing this README
|
||||
|
||||
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
||||
|
||||
## Suggestions for a good README
|
||||
|
||||
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
||||
|
||||
## Name
|
||||
Choose a self-explaining name for your project.
|
||||
|
||||
## Description
|
||||
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
||||
|
||||
## Badges
|
||||
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
||||
|
||||
## Visuals
|
||||
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
||||
|
||||
## Installation
|
||||
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
||||
|
||||
## Usage
|
||||
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
||||
|
||||
## Support
|
||||
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
||||
|
||||
## Roadmap
|
||||
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
||||
|
||||
## Contributing
|
||||
State if you are open to contributions and what your requirements are for accepting them.
|
||||
|
||||
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
||||
|
||||
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
||||
|
||||
## Authors and acknowledgment
|
||||
Show your appreciation to those who have contributed to the project.
|
||||
|
||||
## License
|
||||
For open source projects, say how it is licensed.
|
||||
|
||||
## Project status
|
||||
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
||||
7. Node.js Installation (Optional)
|
||||
- Installs Node.js LTS version
|
||||
|
1
p.pub
Normal file
1
p.pub
Normal file
@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCx49TcvDhhqzhNSUvpMVJdkO6v/U55L69/cJjNT1eYgwKuIUEOb2wsFjrfe13QXo/npGwNQOFCXDoHSm8r0rcIbR74P0lTabHVwUOEQIzrNsLUSbXTYqcukUzlKu2Lg9ywPL7jEytFEFnUQMomgWuEze25EfuHk52K7P6rPAqZ6MUhop+WTq+cQ59beh6sMpriR3j1507gDpzAv0bwGm/QpgAtxPQQYZkOQefzOF+biRn4oY18IEDxWKWhkKBe6lzvDAlRbqwcHl+mRPf75t0CiuuCKAYx7qjL7fOdMCTaK8TPHJvmZFhrU9Dqk4g2TfZSr1wEpHqG4DygRO/6i/Gw0u62XYVJ7U0fmTDzvYhTIj0oF3HKo8Bv11U83hQFlemkHI2UEgc1YJ3FQdtesjsVUPbZwdWyo28cRxx10vdApoWAuqJnlBGC60UFdiIsCVWU/9/NLY1VNd8mOqYkAURZaCUdg413zvoQB3+/saoExxGsg82eazr0ExrHIfVApM0= deck@steamdeck
|
Loading…
x
Reference in New Issue
Block a user