Advertisement
Guest User

Untitled

a guest
Mar 16th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Take input for username and password
  4. read -p "Transmission username: " uname
  5. read -p "$uname's Password: " passw
  6.  
  7. # Update system and install required packages
  8. yum -y update
  9. yum -y install gcc gcc-c++ m4 make automake curl-devel intltool libtool gettext openssl-devel perl-Time-HiRes wget
  10.  
  11. #Create UNIX user and directories for transmission
  12. encrypt_pass=$(perl -e 'print crypt($ARGV[0], "password")' $passw)
  13. useradd -m -p $encrypt_pass $uname
  14. mkdir -p /home/$uname/Downloads/
  15. chown -R $uname.$uname /home/$uname/Downloads/
  16. chmod g+w /home/$uname/Downloads/
  17.  
  18. # Install the firewall (CSF)
  19. cd /usr/local/src
  20. wget http://configserver.com/free/csf.tgz
  21. tar xzf csf.tgz
  22. cd csf
  23. ./install.generic.sh
  24. cd /etc/csf
  25. sed -i 's/^TESTING =.*/TESTING = "0"/' csf.conf
  26. sed -i 's/^TCP_IN =.*/TCP_IN = "22,80,9091,10000,51413"/' csf.conf
  27. sed -i 's/^TCP_OUT =.*/TCP_OUT = "1:65535"/' csf.conf
  28. sed -i 's/^UDP_IN =.*/UDP_IN = "51413"/' csf.conf
  29. sed -i 's/^UDP_OUT =.*/UDP_OUT = "1:65535"/' csf.conf
  30. service csf restart
  31.  
  32. # Install libevent
  33. cd /usr/local/src
  34. wget https://github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz
  35. tar xzf libevent-2.0.19-stable.tar.gz
  36. cd libevent-2.0.19-stable
  37. ./configure --prefix=/usr
  38. make
  39. make install
  40.  
  41. # Where are those libevent libraries?
  42. echo /usr/lib > /etc/ld.so.conf.d/libevent-i386.conf
  43. echo /usr/lib > /etc/ld.so.conf.d/libevent-x86_64.conf
  44. ldconfig
  45. export PKG_CONFIG_PATH=/usr/lib/pkgconfig
  46.  
  47. # Install transmission
  48. cd /usr/local/src
  49. wget http://download.transmissionbt.com/files/transmission-2.51.tar.bz2
  50. tar xjf transmission-2.51.tar.bz2
  51. cd transmission-2.51
  52. ./configure --prefix=/usr
  53. make
  54. make install
  55.  
  56. # Set up init script for transmission-daemon
  57. cd /etc/init.d
  58. wget -O transmissiond http://pastie.org/pastes/962731/download
  59. sed -i "s%TRANSMISSION_HOME=/home/transmission%TRANSMISSION_HOME=/home/$uname%" transmissiond
  60. sed -i 's%DAEMON_USER="transmission"%DAEMON_USER="placeholder123"%' transmissiond
  61. sed -i "s%placeholder123%$uname%" transmissiond
  62. chmod 755 /etc/init.d/transmissiond
  63. chkconfig --add transmissiond
  64. chkconfig --level 345 transmissiond on
  65.  
  66. # Edit the transmission configuration
  67. service transmissiond start
  68. service transmissiond stop
  69. sleep 3
  70. cd /home/$uname/.config/transmission
  71. sed -i 's/^.*rpc-whitelist-enabled.*/"rpc-whitelist-enabled": false,/' settings.json
  72. sed -i 's/^.*rpc-authentication-required.*/"rpc-authentication-required": true,/' settings.json
  73. sed -i 's/^.*rpc-username.*/"rpc-username": "placeholder123",/' settings.json
  74. sed -i 's/^.*rpc-password.*/"rpc-password": "placeholder321",/' settings.json
  75. sed -i "s/placeholder123/$uname/" settings.json
  76. sed -i "s/placeholder321/$passw/" settings.json
  77.  
  78. # Yay!!!
  79. service transmissiond start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement