Skip to content

Instantly share code, notes, and snippets.

@z3ntu
Forked from Era-Dorta/mayaOnUbuntu.sh
Last active November 1, 2019 19:37
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save z3ntu/8ed3fd920ebd8651dd87 to your computer and use it in GitHub Desktop.
Shell script for installing Maya 2016 SP4. Tested on Ubuntu 15.10
#!/bin/bash
# Heith Seewald 2012
# Garoe Dorta 2015
# Luca Weiss 2015
# Also based on https://gist.github.com/MichaelLawton/ee27bf4a0f591bed19ac
# Feel free to extend/modify to meet your needs.
#### Lets run a few checks to make sure things work as expected.
#Make sure we’re running with root permissions.
if [ `whoami` != root ]; then
echo "Please run this script as root!"
echo "Just run 'sudo !!'."
exit
fi
#Check for 64-bit arch
if [ `uname -m` != x86_64 ]; then
echo "Maya will only run on 64-bit Linux."
echo "Please install a 64-bit Ubuntu and try again!"
exit
fi
#Setup a few vars
export INSTALLFILE="Autodesk_Maya_2016_SP4_EN_Linux_64bit.tgz" #name of downloaded file
export INSTALLDIR="/usr/autodesk/maya2016" # file where most files go
export RPM_INSTALL_PREFIX=/usr # idk
export LD_LIBRARY_PATH=/opt/Autodesk/Adlm/R9/lib64/:$LD_LIBRARY_PATH # set the library path #TODO: path does not exist
export TEMPINSTALLDIR=$HOME/"mayaTempInstall" # temporary installation dir in ~
MAYAURL="http://download.autodesk.com/us/support/files/maya_2016_service_pack_4/Autodesk_Maya_2016_SP4_EN_Linux_64bit.tgz" # download url
LIBCRYPTO="/lib/x86_64-linux-gnu/libcrypto.so.1.0.0"
LIBSSL="/lib/x86_64-linux-gnu/libssl.so.1.0.0"
PRODUCTID="657H1"
#Prev ID is for student version
#Install Message
echo ""
echo "This script will download and install Autodesk Maya 2016."
read -p "Do you want to continue? [Y/n] " RESPONSE
case "$RESPONSE" in
n*|N*)
echo "Abort."
exit 0;
esac
#Get serial number
echo "If you have not already done so, you can get your serial number from: http://students.autodesk.com"
read -p "Please enter your serial number: " SERIALNUMBER
echo ""
echo "We will install important packages now."
sudo apt-get -qq install -y libjpeg62 alien csh tcsh libaudiofile-dev libglw1-mesa elfutils gamin libglw1-mesa-dev mesa-utils xfstt ttf-liberation xfonts-100dpi xfonts-75dpi ttf-mscorefonts-installer libgamin0 libxp6
#Create a temp folder for the install files
if [ ! -d "$TEMPINSTALLDIR" ]; then
mkdir $TEMPINSTALLDIR
echo "Creating $TEMPINSTALLDIR folder."
echo ""
fi
cd $TEMPINSTALLDIR
sudo chmod -R 777 $TEMPINSTALLDIR
#Now check to see if you already have maya downloaded and in the install folder.
if [ -f $TEMPINSTALLDIR/$INSTALLFILE ]; then
#Make sure the install file is complete.
echo "The Maya install file was found, verifying it now..."
MAYA_INSTALL_HASH=$(md5sum -b $TEMPINSTALLDIR/$INSTALLFILE | awk '{print $1}')
if [ "$MAYA_INSTALL_HASH" = "e228b13fec224d2e79879c1bc0103d5e" ]; then
echo "The Maya install file was verified - skipping download!"
else
echo "The Maya install file is not complete. We'll try the download it again - resuming the download."
#mv $INSTALLFILE $INSTALLFILE.bak
wget --continue --referer="http://trial.autodesk.com" --content-disposition $MAYAURL
fi
else
echo "The Maya install file was not found. We'll download it now."
wget --referer="http://trial.autodesk.com" --content-disposition $MAYAURL
fi
# Extract Maya Install Files
#tar xvf $TEMPINSTALLDIR/$INSTALLFILE
# Convert rpms to debs
echo "Converting Red Hat .rpm files into Debian .deb. This could take a while..."
for i in $TEMPINSTALLDIR/*.rpm; do
sudo alien -c $i
done
sleep 2s
#install the deb's
echo "Installing the converted .deb files. This also could take a while."
sudo dpkg -i $TEMPINSTALLDIR/*.deb
#Setup For Mental Ray.
sudo mkdir /usr/tmp
sudo chmod 777 /usr/tmp
#Required for license to install
sudo cp libadlmPIT.so.11 /usr/lib/libadlmPIT.so.11
sudo cp libadlmutil.so.11 /usr/lib/libadlmutil.so.11
# License Setup:
sudo echo -e 'MAYA_LICENSE=unlimited\nMAYA_LICENSE_METHOD=standalone' > $INSTALLDIR/bin/License.env
#Notice the lack of sudo.
#export LD_LIBRARY_PATH=/opt/Autodesk/Adlm/R9/lib64/ #TODO: Directory missing
$INSTALLDIR/bin/adlmreg -i S $PRODUCTID $PRODUCTID 2016.0.0.F $SERIALNUMBER /var/opt/Autodesk/Adlm/Maya2016/MayaConfig.pit
# TODO: "Registration failed with code: 32"
# symbolic links:
# Its preferred to use the libssl and libcrypto that’s included with your system... so we’ll try that first.
# We’ll use the files included by autodesk as a fallback
#Libssl Link
if [ -f "$LIBSSL" ]; then
echo "$LIBSSL found. Using it."
sudo ln -s $LIBSSL $INSTALLDIR/lib/libssl.so.10
else
echo "$LIBSSL not found. Using Autodesk’s libssl"
sudo ln -s $INSTALLDIR/support/openssl/libssl.so.6 $INSTALLDIR/lib/libssl.so.10
fi
#LibCrypto Link
if [ -f "$LIBCRYPTO" ]
then
echo "$LIBCRYPTO found. Using it."
sudo ln -s $LIBCRYPTO $INSTALLDIR/lib/libcrypto.so.10
else
echo "$LIBCRYPTO not found. Using Autodesk’s libssl"
sudo ln -s $INSTALLDIR/support/openssl/libcrypto.so.6 $INSTALLDIR/lib/libcrypto.so.10
fi
# libjpeg
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2 /usr/lib/libjpeg.so.62
# libtiff
sudo ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.5.2.0 /usr/lib/libtiff.so.3
# Bug with openGL populate, can do it here permanently, but a better alternative is explained below
# sudo mv /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/baklibGL.so
# sudo ldconfig
# Bitfrost bug
sudo mkdir $INSTALLDIR/plugin-backups
sudo mv $INSTALLDIR/plug-ins/bifrost $INSTALLDIR/plugin-backups/
sleep 2s
echo "Done with initial setup."
echo "You can now try to launch Maya by typing 'maya' into your terminal."
echo "Please look if there were any error messages!"
######################################
## Run this commands once the above script has finished
######################################
#export MAYA_LOCATION=$INSTALLDIR/
#export LD_LIBRARY_PATH=/opt/Autodesk/Adlm/R9/lib64/
#nano mayainstall.c
##add the following in nano, save and close
#int main (void) {return 0;}
#gcc mayainstall.c
#sudo mv /usr/bin/rpm /usr/bin/rpm_backup
#sudo cp a.out /usr/bin/rpm
#chmod +x ./setup
#sudo ./setup
##Then, follow the GUI, Accept, put your Serial Number and the 657G1 thing
#sudo rm /usr/bin/rpm
#sudo mv /usr/bin/rpm_backup /usr/bin/rpm
## Run once as sudo to activate the licence
#sudo maya
##didn’t activate so go to https://registeronce.autodesk.com and when it asks you for request file, get from /tmp/MAYA2016en_USLongCode.xml while maya activation screen is open. You will get a file named Long_Response_Code.xml which will allow you to activate.
###################################
## Close maya and run the following
###################################
## Fix texture crash
# gksudo gedit $INSTALLDIR/bin/maya
## -> Search for the following two lines
## Set up the location of the libquicktime plugins
#setenv LIBQUICKTIME_PLUGIN_DIR "$MAYA_LOCATION/lib"
## -> And add this line below them
#setenv LD_PRELOAD /usr/lib/x86_64-linux-gnu/libjpeg.so.62
## Since Maya was ran once with sudo, reset the owner of the maya folder to user
#sudo chown -R "$USER":"$USER" ~/maya
## If you are a developer this allows you to debug maya
## Allow ptrace, change kernel.yama.ptrace_scope = 1, to 0
#gksudo gedit /etc/sysctl.d/10-ptrace.conf
## This is for solving the OpenGL bug, before Maya starts and leaving the library as it was when Maya exits
## I had problems with other OpenGL programs if I didn't do this
# Rename maya bin
#sudo mv /usr/local/bin/maya /usr/local/bin/oriMaya
## Create a new bin that is a script that runs the old one plus few other things
#sudo touch /usr/local/bin/maya
#gksudo gedit /usr/local/bin/maya
## Add this lines to the script
##!/bin/bash
#sudo -v
## Bug with openGL populate
#sudo mv /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/baklibGL.so
#sudo ldconfig
## Maya does not need sudo to run
#oriMaya
#sudo mv /usr/lib/x86_64-linux-gnu/baklibGL.so /usr/lib/x86_64-linux-gnu/libGL.so
#sudo ldconfig
#############################
## Close the file and you are almost done
############################
## Maya uses the windows key to move around, so disable the Unity hints so that they don't pop up
##Install compizconfig-settings-manager
##Disable Shortcut Hints Overlay
##Uninstall it when you are done
@willcrichton
Copy link

👍 for this. Also, note that if your application is crashing during authentication in /usr/lib64/libssh2.so.* then the libraries that come with the ADLM client are broken. Maya install appears to put this library in /usr/lib64 and it dynamically links to libcrypto and libssl in /opt/Autodesk/Adlm/R11/lib64 (at least on CentOS/RHEL). You have to replace those version of libcrypto/libssl with the ones in /usr/autodesk/maya/support/openssl.

@lifeofdave
Copy link

Has anyone got V-Ray for Maya working with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment