From 49c3e8ce6df20d6ffd2ddc17ebc5290453cdff20 Mon Sep 17 00:00:00 2001 From: simonzhangsz Date: Fri, 29 Dec 2023 12:13:12 +0800 Subject: [PATCH] fix: script --- misc/installOMC.sh | 191 --------------------------------------------- 1 file changed, 191 deletions(-) delete mode 100644 misc/installOMC.sh diff --git a/misc/installOMC.sh b/misc/installOMC.sh deleted file mode 100644 index 772c5e0b..00000000 --- a/misc/installOMC.sh +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/bash - -echo "-------------------please input-------------------" -#please input the new nf ip -read -p "please input your OMC IP: " OMCIP - -echo "-----------------please continue to enter-----------------" -read -p "please input your IMS IP: " IMSIP - -echo "-----------------please continue to enter-----------------" -read -p "please input your AMF IP: " AMFIP - -echo "-----------------please continue to enter-----------------" -read -p "please input your AUSF IP: " AUSFIP - -echo "-----------------please continue to enter-----------------" -read -p "please input your UDM IP: " UDMIP - -echo "-----------------please continue to enter-----------------" -read -p "please input your SMF IP: " SMFIP - -echo "-----------------please continue to enter-----------------" -read -p "please input your PCF IP: " PCFIP - -echo "-----------------please continue to enter-----------------" -read -p "please input your NSSF IP: " NSSFIP - -echo "-----------------please continue to enter-----------------" -read -p "please input your NRF IP: " NRFIP - -echo "-----------------please continue to enter-----------------" -read -p "please input your UPF IP: " UPFIP - -echo "-----------------please continue to enter-----------------" -read -p "please input your MME IP: " MMEIP - -echo "------------please continue to enter Vm account-------------" -read -p "please input your username: " username - -echo "------------please continue to enter Vm password-------------" -read -p "please input your passwd: " passwd - -cd /home/agtuser - -#Creating a local source -tar -xzvf omcpkg*.tar.gz - -mv /etc/apt/sources.list /etc/apt/sources.list-bak - -echo "deb [trusted=yes] file:/home/agtuser/omcpkg archives/" > /etc/apt/sources.list - -sleep 1 - -apt update - -sleep 1 - -#Database installation -apt install -y net-tools software-properties-common - -sleep 1 - -apt-key add mariadb_release_signing_key.asc - -apt install -y mariadb-server - -systemctl start mariadb - -mysql --version - -sudo mysql_secure_installation <<-EOF -1000omc@kp! -y -n -y -y -y -y -EOF - -#You need to enter the password manually:1000omc@kp! - -systemctl enable mariadb - -systemctl restart mariadb - -#Modify mysql datebase root password - -#You need to run the following command -mysql -u root <<-EOF -use mysql -ALTER USER root@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD("1000omc@kp!"); -GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '1000omc@kp!'; -flush privileges; -quit -EOF - -sleep 5 - - -echo "port=33066" >> /etc/mysql/mariadb.conf.d/50-server.cnf - -sed -i "s/127.0.0.1/0.0.0.0/g" /etc/mysql/mariadb.conf.d/50-server.cnf - -systemctl restart mariadb - -#Install WEB server -apt update - -apt install -y nginx - -systemctl enable nginx -systemctl daemon-reload -systemctl start nginx - -#Install and config OMC -dpkg -i omc*.deb - -cp /usr/local/omc/htdocs/front/default/config.js /usr/local/omc/htdocs/front/ - -sed -i "s/192.168.8.100/${OMCIP}/g" /usr/local/omc/htdocs/front/config.js - -cp /usr/local/omc/etc/default/* /usr/local/omc/etc - -sed -i "76s/user: root/user: ${username}/" /usr/local/omc/etc/restconf.yaml - -#Database configuration -/usr/local/omc/bin/importdb.sh <<-EOF -Install -EOF - -#Configure the trusted gateway of the managed NE -apt install -y expect - -echo "${OMCIP} ${username} ${passwd}" > /usr/local/omc/bin/nehosts -echo "${IMSIP} ${username} ${passwd}" >> /usr/local/omc/bin/nehosts -echo "${AMFIP} ${username} ${passwd}" >> /usr/local/omc/bin/nehosts -echo "${AUSFIP} ${username} ${passwd}" >> /usr/local/omc/bin/nehosts -echo "${UDMIP} ${username} ${passwd}" >> /usr/local/omc/bin/nehosts -echo "${SMFIP} ${username} ${passwd}" >> /usr/local/omc/bin/nehosts -echo "${PCFIP} ${username} ${passwd}" >> /usr/local/omc/bin/nehosts -echo "${NSSFIP} ${username} ${passwd}" >> /usr/local/omc/bin/nehosts -echo "${NRFIP} ${username} ${passwd}" >> /usr/local/omc/bin/nehosts -echo "${UPFIP} ${username} ${passwd}" >> /usr/local/omc/bin/nehosts -echo "${MMEIP} ${username} ${passwd}" >> /usr/local/omc/bin/nehosts - -sleep 1 - -cd /usr/local/omc/bin -/usr/local/omc/bin/cpsshkey.sh - -cd /home/agtuser - -sleep 5 - -#adb server configuration -cp /usr/local/db/bin/conf/default/redis.conf /usr/local/db/bin/conf/redis.conf - -sed -i "s/172.16.5.140/${UDMIP}/g" /usr/local/db/bin/conf/redis.conf - -#Modifying User Rights -sudo echo "agtuser ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers -sudo echo "agtuser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers - -sudo scp /etc/sudoers ${username}@${IMSIP}:/home/agtuser -sudo scp /etc/sudoers ${username}@${AMFIP}:/home/agtuser -sudo scp /etc/sudoers ${username}@${AUSFIP}:/home/agtuser -sudo scp /etc/sudoers ${username}@${UDMIP}:/home/agtuser -sudo scp /etc/sudoers ${username}@${SMFIP}:/home/agtuser -sudo scp /etc/sudoers ${username}@${PCFIP}:/home/agtuser -sudo scp /etc/sudoers ${username}@${NSSFIP}:/home/agtuser -sudo scp /etc/sudoers ${username}@${NRFIP}:/home/agtuser -sudo scp /etc/sudoers ${username}@${UPFIP}:/home/agtuser -sudo scp /etc/sudoers ${username}@${MMEIP}:/home/agtuser - -#Run the following commands on each NE VM: -#cp sudoers /etc/sudoers - -sleep 5 - -#Service initiation -systemctl enable restagent.service -systemctl enable crontask.service -systemctl daemon-reload - -/usr/local/omc/bin//omcsvc.sh restart - -systemctl restart nginx - - -echo "-----------------config complete------------" \ No newline at end of file