I am trying to install jenkins in ubuntu. I have followed the commands below:
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add - e
You can go to /etc/default/jenkins and add --httpPort=9999 or whatever port to JENKINS_ARGS.
/etc/default/jenkins
--httpPort=9999
JENKINS_ARGS
Then you should restart Jenkins with sudo service jenkins restart.
sudo service jenkins restart