item8.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. #Item8 ROS ubuntu 18.04 melodic
  3. #ROS It should be install in user not install in root
  4. #install
  5. sudo apt-get install chrony -y
  6. sudo apt-get install ntpdate -y
  7. sudo ntpdate -q ntp.ubuntu.com
  8. #var="deb http://packages.ros.org/ros/ubuntu \$(lsb_release -sc) main"
  9. sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  10. #sudo sh -c "echo $var > /etc/apt/sources.list.d/ros-latest.list"
  11. sudo apt-key adv --keyserver "hkp://keyserver.ubuntu.com:80" --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  12. echo "deb ros packages and keyserver"
  13. sudo apt-get update -y
  14. #sudo apt-get upgrade -y
  15. sudo apt-get install ros-melodic-desktop-full -y
  16. sudo apt-get install ros-melodic-rqt* -y
  17. sudo apt-get install python-rosdep -y
  18. sudo rosdep init
  19. rosdep update
  20. sudo apt-get install python-rosinstall -y
  21. sudo apt-get install python-rosinstall-generator -y
  22. sudo apt-get install python-wstool -y
  23. #setup
  24. echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
  25. source ~/.bashrc
  26. #Create Ros Workspace
  27. mkdir -p /home/使用者/catkin_ws/src
  28. cd /home/使用者/catkin_ws/;pwd;source /opt/ros/melodic/setup.bash;/opt/ros/melodic/bin/catkin_make
  29. #Setup
  30. source /home/使用者/catkin_ws/devel/setup.bash
  31. echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
  32. source ~/.bashrc
  33. # need user name
  34. echo $ROS_PACKAGE_PATH /home/使用者/catkin_ws/src:/opt/ros/melodic/share
  35. source ~/.bashrc
  36. printenv | grep ROS
  37. echo "ROS done"