-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfiles.sh
executable file
·158 lines (134 loc) · 3.83 KB
/
files.sh
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
#Script a executer en Root
function replace
{
if [ -f $2 ] #Si le fichier $2 existe
then
rm -R $2
fi
mv $1 $2
}
install="/backup"
cd $install
#On configure les locales
file="/locale/locale"
path="/etc/default/locale"
replace $install$file $path
file="/locale/locale.gen"
path="/etc/locale.gen"
replace $install$file $path
dpkg-reconfigure locales
echo "=============== Locales mises a jour ==============="
sleep 2
#Config Hostname => Dossier host
file="/host/hostname"
path="/etc/hostname"
replace $install$file $path
file="/host/hosts"
path="/etc/hosts"
replace $install$file $path
#On relance les hosts
/etc/init.d/hostname.sh
echo "=============== Hostnames a jours ==============="
sleep 2
#shell => dossier shell
file="/shell/.bashrc"
path="/root/.bashrc"
replace $install$file $path
echo "=============== Configurations Shell en place ==============="
sleep 2
# Lshell => dossier lshell
file="/lshell/lshell.conf"
path="/etc/lshell.conf"
replace $install$file $path
echo "=============== Configurations LShell en place ==============="
sleep 2
#Config SSH => Dossier ssh
file="/ssh/sshd_config"
path="/etc/ssh/sshd_config"
replace $install$file $path
#On ajoute tous les utilisateurs du système
/script/user.sh
echo "=============== Configurations SSH a jour ==============="
sleep 2
#Config PHP-FPM => Dossier fpm
file="/fpm/php-fpm.conf"
path="/etc/php5/fpm/php-fpm.conf"
replace $install$file $path
file="/fpm/pool.d"
path="/etc/php5/fpm/pool.d"
replace $install$file $path
/etc/init.d/php5-fpm reload
echo "=============== Configurations PHP-FPM a jour ==============="
sleep 2
#Config Nginx => Dossier nginx
file="/nginx/nginx.conf"
path="/etc/nginx/nginx.conf"
replace $install$file $path
mkdir -p /etc/nginx/sites-available/
file="/nginx/default"
path="/etc/nginx/sites-available/default"
replace $install$file $path
/etc/init.d/nginx restart
echo "=============== Configurations Nginx a jour ==============="
sleep 2
#Config Vim => Dossier vim
file="/vim/vimrc.local"
path="/etc/vim/vimrc.local"
replace $install$file $path
file="/vim/molokai.vim"
path="/usr/share/vim/vimcurrent/colors/molokai.vim"
replace $install$file $path
echo "=============== Configurations VIM a jour ==============="
sleep 2
#Configuration de GIT
git config --global user.name "JonathanDekhtiar - Diablo.Server"
git config --global user.email [email protected]
cd ~/.ssh
ssh-keygen -t rsa -C "[email protected]"
echo "############ SSH-Public KEY // COPY TO CLIPBOARD ###########"
echo
cat ~/.ssh/id_rsa.pub
echo
echo "############ SSH-Public KEY // COPY TO CLIPBOARD ###########"
cd $install
sleep 6
#Configuration de OwnCloud
echo "On ajoute l'utilisateur OwnCloud :"
adduser --system --group --quiet owncloud
wget http://download.owncloud.org/community/owncloud-5.0.0.tar.bz2
tar -xjf owncloud-5.0.0.tar.bz2
rm owncloud-5.0.0.tar.bz2
mv owncloud www
mv www /home/owncloud/
chown -R owncloud:owncloud /home/owncloud/
echo "=============== Configurations OWNCLOUD a jour ==============="
sleep 2
#Confiuration ProFTPd => Dossier proftpd
file="/proftpd/proftpd.conf"
path="/etc/proftpd/proftpd.conf"
replace $install$file $path
file="/proftpd/modules.conf"
path="/etc/proftpd/modules.conf"
replace $install$file $path
/etc/init.d/proftpd restart
echo "=============== Configurations ProFTPd a jour ==============="
#On sauvegarde Mysql
file="/mysql/my.cnf"
path="/etc/mysql/my.cnf"
replace $install$file $path
/etc/init.d/mysql reload
echo
echo "Nous allons configurer Mysql, entrer le MdP Root, puis répondre 'No' a la première question puis 'Yes' a toutes les autres"
echo
sleep 4
mysql_secure_installation
echo
echo "=============== Configurations Mysql a jour ==============="
#Finish
echo
echo "#################################### Fin du script d'install ####################################"
echo
sleep 2
ls -al -R
sleep 5