-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinus-defualt-set-up.sh
More file actions
69 lines (55 loc) · 4.54 KB
/
linus-defualt-set-up.sh
File metadata and controls
69 lines (55 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
#--------------------------------------#
# Created by: David Odediran
# Date: 10/10/2021
#--------------------------------------#
#--------------------------------------#
# What this script does
#--------------------------------------#
#This script is used to set up a new Linux server with the following configurations:
# 1. Update the system configuration
# 2. Install git
# 3. Create a new user and make them a sudoer
# 4. Create alias for all users
# 5. Set hostname
# 6. Git clone the network configuration script
# 7. Change directory to the cloned repository
# 8. Make the network configuration script executable
# 9. Launch the network configuration script
#--------------------------------------#
# Update the system configuration
# Install git for Fedora, Amazon Linux, and CentOS
sudo yum update -y
sudo yum install git -y
#echo "Git has been installed."
# Install git for Ubuntu and Debian
#sudo apt-get update -y
#sudo apt-get install git -y
#echo "Git has been installed."
# Create a new user and make them a sudoer
username="david"
# Encrypted password using openssl to generate it
encrypted_password="$(openssl passwd -6 'david1234')"
sudo useradd -c "David Odediran" $username
sudo usermod -aG sudo $username
sudo echo "$username:$encrypted_password" | chpasswd -e
sudo echo "$username ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$username
#echo "User $username has been created and added to the sudo group with sudo privileges."
# Create alias for all users
echo "alias c='clear'" >> /etc/profile
echo "Alias 'c=clear' has been set for all users."
# Set hostname
hostname="CityCat-Server2024" # Type your new hostname
sudo hostnamectl set-hostname $hostname
#echo "Hostname has been set to $hostname."
#Enter the user directory
cd /home/$username
# Git clone the network configuration script
sudo git clone https://github.com/davidblack174/Linux-Server-Configuration
# Change directory to the cloned repository
cd Linux-Server-Configuration
# Make the network configuration script executable
chmod +x server-network-configuration-and-monitoring
# Launch the network configuration script
bash server-network-configuration-and-monitoring
#echo "Network configuration script has been executed."