-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_spacewalk.sh
82 lines (68 loc) · 1.93 KB
/
install_spacewalk.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
#!/bin/sh
client_file=/root/bin/client.sh
do_yum(){
yum clean all
yum -y upgrade ca-certificates --disablerepo=epel
#yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm deltarpm yum-presto screen alpine git http://yum.spacewalkproject.org/2.2/RHEL/6/x86_64/spacewalk-repo-2.2-1.el6.noarch.rpm createrepo repoview
yum -y install epel-release deltarpm yum-presto screen alpine git createrepo repoview http://yum.spacewalkproject.org/2.4/RHEL/7/x86_64/spacewalk-repo-2.4-3.el7.noarch.rpm
yum -y update
}
do_git(){
cd
if [ -d /root/bin ]
then
cd /root/bin
git pull https://github.com/marafa/spacewalk.git
else
git clone https://github.com/marafa/spacewalk.git bin
fi
if [ -d /root/spacewalk ]
then
mv /root/spacewalk /root/bin
fi
cp /root/bin/jpackage*repo /etc/yum.repos.d/jpackage-generic.repo
}
hmm(){ #is this necessary
##from https://fedorahosted.org/spacewalk/wiki/PostgreSQLServerSetup
yum install -y 'postgresql-server > 8.4'
yum install -y postgresql-pltcl
chkconfig postgresql on
service postgresql initdb
service postgresql start
su - postgres -c 'PGPASSWORD=spacepw; createdb -E UTF8 spaceschema ; createlang plpgsql spaceschema ; createlang pltclu spaceschema ; yes $PGPASSWORD | createuser -P -sDR spaceuser'
}
do_firewall(){
service iptables stop
chkconfig iptables off
}
do_postgresql(){
yum -y install spacewalk-setup-postgresql
yum -y install spacewalk-postgresql
}
do_locale(){
#set locale
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
export LANG=en_US.UTF-8
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
#
sed -i 's,LANG=.*,LANG="en_US.UTF-8",g' /etc/sysconfig/i18n
}
do_client_file(){
if [ -f $client_file ]
then
fqdn=`hostname`
ip=`hostname -I`
fi
sed -i "s/fqdn=.*/fqdn=$fqdn/g" $client_file
sed -i "s/ip=.*/ip=$ip/g" $client_file
}
#prepare OS
do_yum
do_git
do_locale
do_firewall
do_postgresql
do_client_file
cd /root/bin
spacewalk-setup --disconnected --answer-file=spacewalk.answer