In this paper, a deep learning long-short-term memory (LSTM) method is applied to the forecasting of the critical frequency of the ionosphere F2 layer (foF2). Hourly values of foF2 from 10 ionospheric stations in China and Australia (based on availability) from 2006 to 2019 are used for training and verifying. While 2015 and 2019 are exclusive for verifying the forecasting accuracy. The inputs of the LSTM model are sequential data for the previous values, which include local time (LT), day number, solar zenith angle, the sunspot number (SSN), the daily F10.7 solar flux, geomagnetic the Ap and Kp indices, geographic coordinates, neutral winds, and the observed value of foF2 at the previous moment. To evaluate the forecasting ability of the deep learning LSTM model, two different neural network forecasting models: a back-propagation neural network (BPNN) and a genetic algorithm optimized backpropagation neural network (GABP) were established for comparative analysis. The foF2 parameters were forecasted under geomagnetic quiet and geomagnetic disturbed conditions during solar activity maximum (2015) and minimum (2019), respectively. The forecasting results of these models are compared with those of the international reference ionosphere model (IRI2016) and the measurements. The diurnal and seasonal variations of foF2 for the 4 models were compared and analyzed from 8 selected verification stations. The forecasting results reveal that the deep learning LSTM model presents the optimal performance of all models in forecasting the time series of foF2, while the IRI2016 model has the poorest forecasting performance, and the BPNN model and GABP model are between two of them.